CSS mapping: inline block resizing text on mobile device?

I created a very simple webpage that works the way I intend on a desktop browser, but shows strange results on mobile devices. Here is the code:

body {
  font-family: "Raleway", "Tahoma", "Helvetica", "Arial", Sans-serif;
  line-height: 1.4;
  color: #303030;
  font-size: 20px;
}

a,
a:visited {
  color: blue;
  text-decoration: none;
}

a:hover {
  color: red;
}

#container {
  width: 900px;
  margin: 30px auto 0px auto;
}

#links .name {
  display: inline-block;
  font-size: inherit;
  width: 90px;
}

#links .link {
  display: inline-block;
  font-size: inherit;
}

.box {
  background-color: rgba(255, 255, 255, 1);
  padding: 20px 20px;
  margin: 20px 0px;
  box-shadow: 0 1px 1px #D0D0D0;
}
<!DOCTYPE html>
<html>
  <body>
    <div id="container">
      <section class="box">
        Hi ! My name is <strong>Name</strong>. You might also know me as <strong>User</strong>. Bla bla bla, this is some text here. But not too much.
      </section>
      <section class="box">
        My main interests are <strong>hobby 1</strong>, <strong>hobby 2</strong>.
      </section>
      <section class="box">
        Reach me easily on <a href="https://twitter.com/Protectator">Twitter</a> !
        <br>
        <br> You can also find me on
        <ul id="links">
          <li>
            <div class="name">Twitter</div>
            <div class="link"><a href="https://twitter.com/Protectator">@Username</a></div>
          </li>
          <li>
            <div class="name">Facebook</div>
            <div class="link"><a href="https://www.facebook.com">Username</a></div>
          </li>
          <li>
            <div class="name">Google+</div>
            <div class="link"><a href="https://plus.google.com">+Username</a></div>
          </li>
        </ul>
      </section>
    </div>
  </body>
</html>
Run code

It works great and displays things the way I want when they are viewed in the dekstop browser: enter image description here

However, when I view a page from a mobile device, the text size of the elements <li>decreases compared to the rest of the page. Here's what it looks like:

enter image description here

, . dev, , font-size <section> , ( 20px body, : enter image description here).

, , <li>?

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

, , . , .

, display: inline-block, <a> inline.

+4
2

:

#container {
  width: 900px;
}

#container {
  max-width: 900px;
}

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

<head > html. , ( ) . css .

:

#container width: 900px, , . , ( , ).

- , , , .

iPhone 6+ portrait view of the site

+5

, , ( Chrome)

, flex inline-block

#container {
  display: flex; \* or display:inline-block *\
}

, ,

0

Source: https://habr.com/ru/post/1654926/


All Articles