Mathias Brodala: Ungewollter Abstand zwischen Elementen

Beitrag lesen

Hallo Franz.

body {
   background-color: #F2F2F2;
   margin: 0px;
   padding: 0px;
}
#page {
   font: 12px Helvetica, Arial, Sans-Serif;
   width:790px;
   margin: auto;
   padding: 0px;
   background: #ffffff url(background.png);
   color:black
}
#nerdytext { margin-right:30px; margin-left:300px}

  
Ohne das zugehörige HTML ist das CSS wertlos.  
  

> Ergebnis (FF 1.5.0.6 oder so):  
> ![](http://img153.imageshack.us/img153/7645/leberaa9.jpg)  
  
Ich kann dieses Resultat mit folgendem Code nicht nachstellen:  
  
~~~html
<body>  
  <div id="page">  
    <div id="nerdytext">Langer Fülltext …</div>  
  </div>  
</body>

PS: Man könnte bei #page einen margin-top:-15px oder so einfügen, aber das find ich doof.

Oder einfach folgendes am Anfang eines jeden Stylesheets notieren und sich keine weiteren Gedanken über eventuelle Abstände in Browserstylesheets machen:

* {  
  margin:0;  
  padding:0;  
}

Einen schönen Montag noch.

Gruß, Mathias

--
sh:( fo:} ch:? rl:( br: n4:~ ie:{ mo:| va:) de:> zu:} fl:( ss:) ls:[ js:|
„It is required that HTML be a common language between all platforms. This implies no device-specific markup, or anything which requires control over fonts or colors, for example. This is in keeping with the SGML ideal.“
[HTML Design Constraints: Logical Markup]