2010-04-27 59 views
0

所以我想搞亂Sass,所以我創建了這個小小的令人難以置信的簡單小頁面。對於我未知的原因,當我向#content添加頂部邊距時,它會改變我的包裝div。任何有關爲何發生這種情況的信息將不勝感激。謝謝!css格式問題

這裏是網頁直播:http://cheapramen.com/omg/

HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 

<head> 
<link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" /> 



<title>YO</title> 

</head> 

<body> 

<div id="wrapper"> 

<div id="content"> 

<div class="dog"> 
Bury me with my money 
</div> 

</div> 






</div> 
</body> 
</html> 

薩斯

html body 
    background-color: #000 
    padding: 0 
    margin: 0 
    height: 100% 

#wrapper 
    background-color: #fff 
    width: 900px 
    height: 700px 
    margin: 0 auto 

#content 
    width: 500px 
    margin: 150px 0 0 50px 

.dog 
    color: #FF3836 
    font-size: 25px 
    text-shadow: 2px 2px 2px #000 
    width: 500px 
    height: 500px 
    -moz-border-radius: 5px 
    -webkit-border-radius: 5px 
    border: 18px solid #FF3836 

的CSS的薩斯吐出

html body { background-color: #000; padding: 0; margin: 0; height: 100%; } 

#wrapper { background-color: #fff; width: 900px; height: 700px; margin: 0 auto; } 

#content { width: 500px; margin: 150px 0 0 50px; } 

.dog { color: #FF3836; font-size: 25px; text-shadow: 2px 2px 2px #000; width: 500px; height: 500px; -moz-border-radius: 5px; -webkit-border-radius: 5px; border: 18px solid #FF3836; } 

回答

0

你這樣做合作rrectly。你錯過的東西是float: left。改變你的線路:

#content { width: 500px; margin: 150px 0 0 50px; float: left; } 
+0

@Davey你有沒有試過這個呢? – orokusaki 2010-04-27 23:24:31