無固定width/height容器內(nèi)的絕對(duì)定位元素拉伸
無固定width/height容器內(nèi)的絕對(duì)定位元素拉伸
任務(wù)
老師視頻里的不同布局寫法,不是習(xí)題?。〔皇橇?xí)題?。?!
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>無固定width/height容器內(nèi)的絕對(duì)定位元素拉伸</title>
<style>
body {
background-color: #ddd;
}
img {
vertical-align: bottom;
}
.container {
display: inline-block;
position: relative;
}
.cover {
position: absolute;
left: 0; top: 0; right: 0; bottom: 0;
background-color: #fff;
opacity: .5; filter: alpha(opacity=50);
}
</style>
</head>
<body>
<span class="container">
<i class="cover"></i>
<img src="http://img1.sycdn.imooc.com//547c34cf000171a002560191.jpg" width="512" height="381">
</span>
<span class="container">
<i class="cover"></i>
<img src="http://img1.sycdn.imooc.com//547c34c9000171a002560191.jpg" width="256" height="191">
</span>
</body>
</html>
請(qǐng)驗(yàn)證,完成請(qǐng)求
由于請(qǐng)求次數(shù)過多,請(qǐng)先驗(yàn)證,完成再次請(qǐng)求