[ 1 post ]

Max Bauer

  • Username: bemax
  • Joined: Sun Aug 01, 2010 12:39 pm
  • Posts: 1
  • Offline
  • Profile

first child of body should not have a top-margin

Post Posted: Sun Aug 01, 2010 1:04 pm
+0-
Hello,

if the first child of the Body Element has a top-margin and the body has a background color or image, a bar in html-background color arose at the top of the page. (also a opening div between body and h1 does not help)

Code:
<html>
<head>
<link rel="stylesheet" type="text/css" href="reset.css">
<link rel="stylesheet" type="text/css" href="base.css">

</head>
<body style="background-color: #444">
<h1>works not</h1>
<h1 style="margin-top:0;">works</h1>
<p>text</p>

</body>
</html>


Fix: instead of
Code:
html{
   color:#000;
   background:#FFF;
}

use
Code:
body{
   color:#000;
   background:#FFF;
}


By the way the html tag allows only version,dir and lang as attribute (and no style) so this maybe the more standard conform way

Windows Vista, Firefox 3.6.8.

Max
  [ 1 post ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum