Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
586 views
in Technique[技术] by (71.8m points)

html - Font size extremely small on mobile devices

I have a <p> block in a huge <div> in the main body of my html with 80% in font-size, and also I have a footer <div> in the lower part of my body.

The text in the footer has also 80% font-size, and if I test it on my PC it is equal, but if I test it in a mobile device, the text of the footer is extremely small, impossible to be read.

How is this possible? Which is the explanation and how can this be avoided?

My main text:

<div id="mainTextContainer" class="text">
    <p>test text</p>
</div>

My footer:

<div id="cookiesBar">
    <div>
        Esta web utiliza 'cookies' para su navegación. Al utilizar nuestros servicios
        aceptas su uso.        
    </div>
</div>

    

My CSS:

#cookiesBar {
    display: none;
    position: fixed;
    left: 0px;
    right: 0px;
    bottom: 0px;
    width: 100%;
    text-align: center;
    height: auto;
    background-color: rgba(136, 188, 182, 0.7);
    z-index: 99999;
    border-radius: 0px;
    text-decoration: none;
    line-height: 30px;
    font-size: 80%;
    font-family: verdana;
}

#mainTextContainer {
    width: 80%;
    margin: auto;
    text-align: center;
    margin-top: 60px;
}

.text {
    font-size: 80%;
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Have you added the viewport meta tag to your document?

If not, add this to your head section:

<meta name="viewport" content="width=device-width, initial-scale=1">

A mobile browser will naturally attempt to zoom out to display your entire web page like a desktop browser. The viewport meta tag scales your page to the device width.

More information:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...