我不熟悉 CSS,这是我的第一个项目之一。我试图为我拥有的滑块制作 CSS 样式,我想要这样的东西:
我已经成功地制作了内部 div 和按钮 div,但让我烦恼的是滑块上下一个/上一个按钮的索引顺序。这是HTML:
<div class="slider">
<div><a href="#" id="rhandle">></a></div>
<div><a href="#" id="lhandle"><</a></div>
<div id="loadingBar"></div>
<div class="slide">
<div id="leftSlide">
<h1>WhiteFox Template</h1>
<p>Buy this theme today with all features, All fonts included in this theme are for personal use only. <br />Detailed documentation included.</p>
<a href="#" class="button">Read More</a>
</div>
<div id="rightSlide">
<img src="images/slides/slide-1.gif" width="259" height="184" alt="slide-1 Image" />
</div>
<div style="height:0;line-height:0;display:block;clear:both;"></div>
</div>
这是滑块的 CSS:
.slider {
height: 329px;
width: 794px;
background: #313131;
margin: 50px auto 80px;
color: #FFF;
}
.slider a#lhandle {
font-size: 24px;
color: #FFF;
background: #4bacfd;
width: 50px;
float: left;
height: 23px;
padding-top: 150px;
padding-bottom: 150px;
margin-top: 6px;
}
.slider a#rhandle {
font-size: 24px;
color: #FFF;
background: #4bacfd;
width: 50px;
float: right;
height: 23px;
padding-top: 150px;
padding-bottom: 150px;
margin-top: 6px;
}
.slider a#lhandle:hover,
.slider a#rhandle:hover {
color: #4bacfd;
background: #FFF;
border: 1px solid #4bacfd;
width: 48px;
height: 21px;
}
.slider #loadingBar {
background: #a0a0a0;
height: 6px;
}
.slider .slide {
height: 328px;
width: 793px;
position: relative;
}
.slider .slide h1 {
text-transform: uppercase;
font-size: 24px;
font-weight: bold;
margin-top: 50px;
margin-bottom: 25px;
}
.slider .slide div#leftSlide {
float: left;
width: 400px;
height: 328px;
}
.slider .slide div#rightSlide {
float: right;
height: 328px;
width: 280px;
}
.slider .slide img {
border: 1px solid #FFF;
margin-top: 25%;
margin-bottom: 25%;
}
.slider .slide p {
display: block;
text-align: justify;
margin-bottom: 30px;
margin-right: 30px;
margin-left: 30px;
font-size: 18px;
line-height: 28px;
}
这样,下一个/上一个按钮位于实际内容下方,当您将鼠标悬停在它们上方时,它们不会变为“:悬停”样式。我已经尝试添加一个“z-index:5”属性,但这不起作用,我该如何实现(如果有更简单的方法,请告诉我)。