0

他の Div が背景の上に表示されない理由がわかりません。ただし、画面に合わせて背景が必要です。

<title>The Ultimate Cube World Resource!</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>   

 <div id="container">
 Test
 </div>   

<div style='position:absolute;z-index:0;left:0;top:0;width:100%;height:100%'>
  <img src='img/bfg.jpg' style='width:100%;height:100%' alt='[The Ultimate Resource for      
veryting Cube World! Also, we have a forum and soon a SERVER]' />
</div>


</body>

@charset "utf-8";
/* CSS Document */

#container
{
width:300px;
height:400px;
margin-right:auto;
margin-left:auto;
z-index:5;
}
4

1 に答える 1

2

z-index配置された要素でのみ機能します。position:relativeルールに追加してみてください。

このjsFiddleの例を参照してください(位置ルールをコメントアウトしてみてください)

于 2013-07-03T18:37:23.373 に答える