效果出來不一樣,那個(gè)縮略圖沒有在預(yù)期的位置0.0
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Preview Slideshow</title>
<style>
*{
padding:0;
margin: 0;
}
body{
padding:50px 0;
background-color: #fff;
font-size:14px;
font-family:'Avenir Next';
color:#555;
-webkit-font-smoothing:antialiased;
/*字體抗鋸齒*/
}
.slider .main,.slider .main .main-i,
.slider{
width: 100%;
height: 400px;
position:relative;
/*overflow: hidden;*/
}
.slider .main{
overflow: hidden;
}
{
}
.slider .main .main-i img{
width: 100%;
position:absolute;
left: 0;
top:0;
z-index: 1;
}
.slider .main .main-i .caption{
position: absolute;
right: 50%;
top: 30%;
z-index: 9;
}
.slider .main .main-i .caption h2{
text-align: right;
font-size: 40px;
line-height: 50px;
color: #b5b5b5;
}
.slider .main .main-i .caption h3{
text-align: right;
font-size: 70px;
line-height: 70px;
color: #000;
font-family: 'Open Sans Condensed';
}
.slider .ctrl{
width: 100%;
height: 13px;
line-height: 13px;
text-align: center;
position: absolute;
left: 0;
bottom: -13px;
background-color: #f00;
}
.slider .ctrl .ctrl-i{
display: inline-block;
width: 150px;
height: 13px;
background-color: #666;
box-shadow: 0 1px 1px rgba(0,0,0,.3);
}
.slider .ctrl .ctrl-i img{
position: absolute;
width: 100%;
left: 0;
bottom: 50px;
}
</style>
</head>
<body>
<div>
<div>
<div>
<div>
<h2>H2 caption</h2>
<h3>H3 caption</h3>
</div>
<img src="imgs/{{index}}.jpg" alt="">
</div>
</div>
<div>
<a href="javascript:void(0);">
<img src="imgs/{{index}}.jpg" alt="">
</a>
</div>
</div>
</body>
</html>
2019-01-26
看到這里解決我的問題了 我也是跟著代碼敲 最后圖片加了position 直接定位爆炸 我想問下 不給a 也就是ctrl-i設(shè)置定位 那么他的最近的父元素不是ctrl么 怎么定位會(huì)定到上面去嘞 ctrl也有position屬性啊 雖然是absolute
2017-03-18
發(fā)現(xiàn)不僅要給a設(shè)置position屬性· 還要給a設(shè)置display:inline-block ,width heigth ? 要不a是沒有寬高的,
2017-03-09
已解決,一直很奇怪為什么圖片沒有100顯示在a里,找了半天才發(fā)現(xiàn)是a標(biāo)簽沒有設(shè)置position:relative;
經(jīng)驗(yàn)告訴我們不要跟著敲代碼不要跟著敲代碼不要跟著敲代碼!