1

I have no idea what's causing this, but it seems like some combination of grid container, ul and li text being wider than the container causes the font size of the text to GROW as screen size of either smartphone or in Chrome phone simulation. This of course causes text to be disproportionate towards the rest of the page which pretty much breaks any design.

As far as I can say this should replicate the problem:

    <html lang="sr">
<head>
    <meta charset="utf-8"/>
    <style>
        body {
            margin: 0;
            font-style: normal;
            font-family: Robo, Arial, Helvetica, sans-serif;
            font-size: 16px;
            display: grid;
            grid-template-columns: 300px auto;
        }
        .nav {
            margin: 0;
            padding: 5px;
            grid-column: 1;
            background-color: yellow;
            border-top-right-radius: 10px;
            border-bottom-right-radius: 10px;
        }
    </style>    
</head>
<body>
<div class="nav">
    <p><a href="#">THis is a test text to show when and how this effect happens.</a></p>
    <p>THis is a test text to show when and how this effect happens.</p>
    <p><a href="#">THis is a test text to show when and how this effect happens.</a></p>
    <ul>
        <li><h3>Test</h3>
            <ul>
                <li>ABC</li>
                <li><a href="#" >THis is a test text to show when and how this effect happens.</a></li>
            </ul>
        </li>
    </ul>
</div>
</body>
</html>

With this page if you open it on a computer it should show something like this:

How it should be

But if I switch to device mode in Chrome inspector and reduce the width I get something like this:

enter image description here

Same happens if I view the page on a smartphone:

enter image description here

Inspector shows that for example that ABC item, even though it's font size should be 16px, the height of the item is 49px, for some reason.

So, what completely obvious thing am I missing here?!?

4th Dimension
  • 65
  • 2
  • 11
  • Try using [em instead of px](https://stackoverflow.com/questions/609517/why-em-instead-of-px). Also as the answer suggests add `viewport` meta tag which will help in overall responsive scaling of the page. – Nuhman Mar 04 '20 at 07:22

1 Answers1

1

This is because you didn't set the viewport. Try to add this to your head.

<meta name="viewport" content="width=device-width">