#home-slider
应该完全居中在 . 内的所有其他 div 后面#home
。margin
并且padding
似乎不起作用,因为它 #home-slider
仍然位于其父 div 的顶部左侧。我还能如何将其降低并居中?或者更确切地说,我错过了什么?
html
<!-- language: lang-html -->
<div id="home">
<div id="home-slider">
<img src="http://lorempixel.com/g/840/420" alt="home-slider" />
</div>
<div class="logo">
<h1><a href="#"><img src="http://lorempixel.com/232/232" alt="logo" id="logo" /></a></h1>
</div><!-- end logo -->
<div id="slider_mask">
<div class="slide_container">
<div class="slide"><p>is where creative <i>je ne sais quoi</i> + business savvy collide.</p></div>
<div class="slide"><p>is the maker + doer for makers + doers</p></div>
<div class="slide">
<ul>
<li>No items.</li> </ul>
</div>
</div>
<div class="left_button"><a href="#" class="left-arrow" title="left arrow"></a></div>
<div class="right_button"><a href="#" class="right-arrow" title="right arrow"></a></div>
</div>
</div><!-- end home -->
css
#home-slider {
top:0;
height:100%;
left:0;
position:fixed;
z-index:-9999;
}
#home .logo {
padding-top: 215px;
margin: 0 auto;
width: 232px;
}
#home #slider_mask {
width: 600px;
margin: 0 auto;
padding-top: 60px;
position: relative;
overflow: hidden;
}
#home #slider_mask .left_button {
float: left;
display: block;
width: 23px;
height: 25px;
background: url(img/left-arrow.png);
text-indent: -99999px;
}
#home #slider_mask .left_button:hover {
background: url(img/left-arrow-hover.png);
background-position: 0 0;
}
#home #slider_mask .slide_container {
float: left;
font-size: 120%;
text-align: center;
width: 300px;
}
#home #slider_mask .right_button {
float: right;
display: block;
width: 23px;
height: 25px;
background: url(img/right-arrow.png);
text-indent: -99999px;
}
#home #slider_mask .right_button:hover {
background: url(img/right-arrow-hover.png);
background-position: 0 0;
}
#home #slider_mask .slide {
float: left;
display: block;
text-align: center;
}