コンテナー内に div をプッシュする方法を見つけようとしています。上からのマージンを設定する500px
と、コンテナー内の 1 つおきの div が押し下げられます。私が得ているものと、それをどのように見せたいかの2枚の写真が含まれています. また、コードを含めました。
これは、完成したウェブサイトの私の Photoshop レンダリングです。
色付きのボックスを配置する作業を行っているところです。ページのにbackground image
設定されているグラデーションbody
です。header
ボタン、画像、ログインタブがある上の画像の白い部分です。は、右側に小さな白い線がある のcore
すぐ下の領域である必要があります。header
はbottomOutsideBox
外側のグラデーションのすぐ下にある明るい灰色のボックスである必要があり、 が上からに設定されているため、ページの上部の下core
に配置する必要があります。画像の上部にある小さな緑のギャップは、設定するとすべてが押し下げられたため、その上に緑が少しあります。が欲しい500px
header
500px
500px
margin-top:500px
header
一番上にとどまり、そのcore
すぐ下とbottomOutsideBox
の外側にありcore
ます。写真では黒く設定してbottomOutsideBox
いるので見分けやすいです。
/*gradient*/
body {
background-image:url('../Images/gradient.gif');
background-color:#000000;
}
header {
width: 750px;
height: 500px;
background-color: #FFFFFF;
margin-left: auto;
margin-right: auto;
display:block;
}
div#bottomoutsidebox {
background-color: #000000;
margin-top: 500px;
width: auto;
}
/* page core */
div#core {
display: block;
margin-left: auto;
margin-right: auto;
background-color: #dadbd6;
width: 750px;
height: 250px;
clear: both;
}
img.mainLogo {
display:block;
margin-left:auto;
margin-right:auto;
}
HTML:
<!doctype html>
<head>
<meta charset="utf-8">
<title>testing</title>
<meta name="description" content="Welcome to my basic template.">
<link rel="stylesheet" href="css/style.css?v=1">
</head>
<body>
<div id="wrapper">
<div id="bottomoutsidebox">
<header>
<img class="mainLogo" src="Images/logo.jpg"/>
</header>
<div id="core">
</div>
<footer>
<p>Some copyright and legal notices here. Maybe use the © symbol a bit.</p>
</footer>
</div>
</div>
</body>
</html>