html - CSS adds automatic margin on small screens in portrait mode -


this code:

<html>    <head>    <style>      body {        margin: auto;        width: 720px;      }    </style>    </head>    <body>    <p>lorem ipsum dolor sit amet. lorem ipsum dolor sit amet. lorem ipsum dolor sit amet. lorem ipsum dolor sit amet. lorem ipsum dolor sit amet. lorem ipsum dolor sit amet. lorem ipsum dolor sit amet. lorem ipsum dolor sit amet. lorem ipsum dolor sit amet.      lorem ipsum dolor sit amet. lorem ipsum dolor sit amet. lorem ipsum dolor sit amet.</p>  </body>    </html>

when running on full hd screen in portrait mode, fine: paragraph width 720px. if change width 1080px fine aswell: there no margin - paragraph goes 1 side of page other.

but if i try view on 720x1280 hd screen in portrait mode, 130px margin added automatically.

why happen? margin: auto messing on smaller screens? how fix it? appreciated.

 <style>     body{     margin: 0 auto;     width:720px;}  </style> 

this should work, check jsfiddle.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -