Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I remove space (margin) above HTML header?

I am creating a website.

I have written the HTML part and now I am writing the stylesheet. But there is always some space above my header. How can I remove it?

My HTML and CSS code is given below.

body{    margin: 0px;    padding: 0px;  }    header{    margin: 0px;    padding: 0px;    height: 20em;    background-color: #C0C0C0;  }
<header>    <h1>OQ Online Judge</h1>    <form action="<?php echo base_url();?>/index.php/base/si" method="post">      <label for="email1">E-mail : </label><input type="text" name="email" id="email1">      <label for="password1">Password : </label><input type="password" name="password" id="password1">      <input type="submit" name="submit" value="Login">    </form>  </header>
like image 419
odbhut.shei.chhele Avatar asked Jan 20 '13 10:01

odbhut.shei.chhele


1 Answers

Try:

h1 {     margin-top: 0; } 

You're seeing the effects of margin collapsing.

like image 59
robertc Avatar answered Sep 18 '22 16:09

robertc