2013-05-26 32 views
0

我要外陰影添加到我的網頁的身體,例如:形影的CSS

<html> 
    <head> 
    <title>Shadow</title> 
    <style> 
     html{height:100%;} 
     body{height:100%;} 
     #shadow{width:1200px;background:url('http://i.stack.imgur.com/w3fOE.png');height:100%;margin: 0 auto;} 
     #theMainContainer{width:900px;margin:0 auto;background-color:red;height:100%;text-align:center; color:white;} 
    </style> 
    </head> 
    <body> 
    <div id="shadow"> 
     <div id="theMainContainer"> 
     i have <font color="black">shadow</font> in the left side and the right side of the page ,<br>But i have space in the top and in the bottom of the page(what is the best way to fix it?). 
     </div> 
    </div> 
    </body> 
</html> 

我在上面,並在頁面的底部有空間。我怎樣才能去掉這個空間並且讓這個影子達到100%的高度?

回答

1

添加margin: 0身體:

body { 
    height: 100%; 
    margin: 0; 
} 
+0

謝謝。 =)它現在有效。 – LC123

+0

還將padding:0添加到body標籤 –

1

您需要添加下面的CSS規則重置瀏覽器的默認樣式。

body, html { 
    margin: 0; 
    padding: 0; 
}