5 回答
TA贡献3593条经验 获得超0个赞
TA贡献2条经验 获得超0个赞
*{
padding: 0;
margin: 0 auto;
font-family: "宋体";
}
.Slider,.Content,.Main{
width: 100%;
height: 400px;
}
/*幻灯片内容*/
.Content /*.Main*/{
position: relative;
}
/*幻灯片图片*/
.Content .Main img{
width: 100%;
height: 400px;
}
/*幻灯片主题*/
.Content .Main .Caption{
position: absolute;
top:22%;
left: 25%;
}
.Content .Main .Caption h2{
font-size: 40px;
line-height: 50px;
text-align: right;
margin-right: -45px;
color: gray;
}
.Content .Main .Caption h3{
font-size: 75px;
line-height: 75px;
text-align: left;
margin-left: -45px;
color: rgb(000,000,000);
}
/*幻灯片控制按钮*/
.Content .Control{
width: 100%;
height: 13px;
position: absolute;
left: 0;
bottom:-13px;
background: red;
text-align: center;
}
.Content .Control a{
display: inline-block;
background: gray;
width: 180px;
height: 13px;
position: relative;
}
.Content .Control img{
width: 180px;
position: absolute;
bottom: 13px;
left: 0;
}
.main-active .Caption h2{
margin-right: 0;
transition: all,0.5s;
}
.main-active .Caption h3{
margin-left: 0;
transition: all,0.8s;
}
html:
<!DOCTYPE html>
<html>
<head>
<title>带预览效果的幻灯片</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/index.css">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/index.js"></script>
</head>
<body>
<div class="Slider">
<div class="Content" id="tpl">
<div class="Main" id="main-i" class="main-active">
<img src="img/{{index}}.jpg">
<div class="Caption">
<h2>{{h2}}</h2>
<h3>{{h3}}</h3>
</div>
</div>
<div class="Control">
<a href="javascript:switch();" class="Ctrl" id="ctrl-i"></a>
<a href="javascript:switch();" class="Ctrl" id="ctrl-i"></a>
</div>
</div>
</div>
</body>
</html>
- 5 回答
- 1 关注
- 7083 浏览
添加回答
举报