2

私は完全な背景レイアウトを持っていますが、白いコンテンツボックスの位置が予期しない位置にあり、常に異なる画面解像度の中央に配置されているとは限りません。液体にするべきですか、それとも弾性にするべきですか?現在、修正されています。

中央とマージンのコンテンツボックスに固定幅のコンテナを使用してみました:0 auto、しかしそれは何もしませんでした

コードを参照してください:http ://avisuals.web.fc2.com/testexample.html

私は何をすべきか?助言がありますか?

4

3 に答える 3

2

cssファイルstyle.csshttp://avisuals.web.fc2.com/style.cssでこれに従って変更し ます

#container{
width: 960px;
margin: 0 auto;
}

からマージンを削除します

#contentbox-top and #content1 and contentbox-bottom

すなわち

#contentbox-top {
margin: 0 auto;
background-image: url(images/content_top.png);
background-repeat: no-repeat;
_background: none;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=images/content_top.png,sizingMethod=crop);
width: 700px;
height: 37px;
position: relative;
z-index: 1;
}

#content1 {
margin: 0 auto;
background: url(images/content_middle.png) repeat-y center;
width: 692px;
position: relative;
}

#contentbox-bottom {
margin: 0 auto;
background-image: url(images/content_bottom.png);
_background: none;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=images/content_bottom.png,sizingMethod=crop);
background-repeat: no-repeat;
width: 700px;
height: 37px;
position: relative;
}
于 2012-06-12T05:30:15.583 に答える
0

あなたが抱えている問題を解決するために。あなたはただ設定するべきだと思います。あなたはmargin:0 auto設定し、設定margin-topmargin-leftた後margin:0 auto。それが問題を引き起こしているのではないかと思います。

デモフィドルを確認してください。

お役に立てば幸いです。

于 2012-06-12T05:35:42.077 に答える
0

中央に配置する要素を含む要素を設定しますtext-align:center。次に、中央に配置する要素の左右の余白を。に設定しautoます。次に、それらより上のものはすべて、画面の幅に拡張できる幅を持っている必要があります。widthプロパティに設定するwidth:autoか、単に省略します。

#containerあなたのサイトを見て、あなたは体の要素の内側に集中させたいです。また#container、適切な幅を指定してください。

于 2012-06-12T05:31:11.220 に答える