html - Header 'div' not aligned exactly to the top of screen (Simple but frustrating) -


i adding header navbar html page.but problem not aligned top.there small gap between browser , navbar.i found solution setting margin:0;,but issue have work if code selecting whole div... like

*{ margin:0;}

why ?

i found solution in stackoverflow question cant comment , ask because have low repuation.he stating because of sass.but how code becoming sass because using normal simple procedure css coding.

linked soultion question.(please check comments in correct selected question) header not touching top of screen

my code :

<html>   <head>     <style>        * {         margin:0;       }        .new {         width:100%;         background-color: blue;       }     </style>   </head>   <body>      <div class="new">new website</div>   </body> </html> 

some browser have set user agent stylesheet @ "body" tag

for chrome: body have margin: 8; on body tag, small gap between navbar.

you can set

body{     margin: 0; } 

will solve problem.

http://jsbin.com/luqoruqewa/edit?html,output


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo