2010-04-27 77 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