0

たとえば、ページの本文に外側の影を追加したい:

<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% の高さにするにはどうすればよいですか?

4

2 に答える 2

1

ブラウザのデフォルト スタイルをリセットするには、次の css ルールを追加する必要があります。

body, html {
    margin: 0;
    padding: 0;
}
于 2013-05-26T14:02:32.500 に答える
1

margin: 0本文に追加:

body {
  height: 100%;
  margin: 0;
}
于 2013-05-26T14:00:48.993 に答える