音悅商城首頁總結
html頁面
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="css/index.css"/>
</head>
<body>
<script type="text/javascript">
window.onload=function(){
var myImg=document.getElementById("img");
var arr=["img/banner/1.jpg","img/banner/2.jpg","img/banner/3.jpg","img/banner/4.jpg"];
var n=0;
setInterval(function(){
n++;
if(n==arr.length){
n=0;
}
myImg.src=arr[n];
},1000);
}
</script>
<div class="content">
<div class="banner">
<img id="img" src="img/banner/1.jpg" >
</div>
<div class="star">
<div class="title">
</div>
<ul>
<li><img src="img/necessary-1.png" alt=""><span>官方應援手幅專區</span></li>
<li><img src="img/necessary-2.gif" alt=""><span>官方應援手幅專區</span></li>
<li><img src="img/necessary-3.png" alt=""><span>官方應援手幅專區</span></li>
<li><img src="img/necessary-4.gif" alt=""><span>官方應援手幅專區</span></li>
<li><img src="img/special.jpg" alt=""></li>
</ul>
</div>
<div class="top">
<div class="title">
</div>
<ul>
<li><a href="list.html"><img src="img/top/a/toplist_a01.jpg" alt="">薛之謙</a></li>
<li><a href="list.html"><img src="img/top/a/toplist_a02.jpg" alt="">iKON</a></li>
<li><a href="list.html"><img src="img/top/a/toplist_a03.jpg" alt="">鹿晗</a></li>
<li><a href="list.html"><img src="img/top/a/toplist_a04.jpg" alt="">GOT7</a></li>
<li><a href="list.html"><img src="img/top/a/toplist_a05.jpg" alt="">EXO</a></li>
<li><a href="list.html"><img src="img/top/a/toplist_a06.jpg" alt="">Astroke(韓國)</a></li>
<li><a href="list.html"><img src="img/top/a/toplist_a07.jpg" alt="">Winner</a></li>
<li><a href="list.html"><img src="img/top/a/toplist_a08.jpg" alt="">BigBang</a></li>
</ul>
</div>
<div class="list">
<div class="title2">
</div>
<ul>
<li>
<img src="img/pro/1.jpg" alt="">
<div class="right">
<span class="title">【現貨包郵】加一聯創1more bear 萬魔熊 頭</span>
<span class="money">¥50</span>
<div><span class="love"></span><span class="num">0</span></div>
</div>
</li>
<li>
<img src="img/pro/2.jpg" alt="">
<div class="right">
<span class="title">【現貨包郵】加一聯創1more bear 萬魔熊 頭</span>
<span class="money">¥50</span>
<div><span class="love"></span><span class="num">0</span></div>
</div>
</li>
<li>
<img src="img/pro/3.jpg" alt="">
<div class="right">
<span class="title">【現貨包郵】加一聯創1more bear 萬魔熊 頭</span>
<span class="money">¥50</span>
<div><span class="love"></span><span class="num">0</span></div>
</div>
</li>
<li>
<img src="img/pro/4.jpg" alt="">
<div class="right">
<span class="title">【現貨包郵】加一聯創1more bear 萬魔熊 頭</span>
<span class="money">¥50</span>
<div><span class="love"></span><span class="num">0</span></div>
</div>
</li>
<li>
<img src="img/pro/5.jpg" alt="">
<div class="right">
<span class="title">【現貨包郵】加一聯創1more bear 萬魔熊 頭</span>
<span class="money">¥50</span>
<div><span class="love"></span><span class="num">0</span></div>
</div>
</li>
<li>
<img src="img/pro/6.jpg" alt="">
<div class="right">
<span class="title">【現貨包郵】加一聯創1more bear 萬魔熊 頭</span>
<span class="money">¥50</span>
<div><span class="love"></span><span class="num">0</span></div>
</div>
</li>
<li>
<img src="img/pro/7.jpg" alt="">
<div class="right">
<span class="title">【現貨包郵】加一聯創1more bear 萬魔熊 頭</span>
<span class="money">¥50</span>
<div><span class="love"></span><span class="num">0</span></div>
</div>
</li>
<li>
<img src="img/pro/8.jpg" alt="">
<div class="right">
<span class="title">【現貨包郵】加一聯創1more bear 萬魔熊 頭</span>
<span class="money">¥50</span>
<div><span class="love"></span><span class="num">0</span></div>
</div>
</li>
<li>
<img src="img/pro/9.jpg" alt="">
<div class="right">
<span class="title">【現貨包郵】加一聯創1more bear 萬魔熊 頭</span>
<span class="money">¥50</span>
<div><span class="love"></span><span class="num">0</span></div>
</div>
</li>
</ul>
</div>
</div>
<div class="tubiao">
<img src="img/footer_v180123.png" >
</div>
</body>
</html>
CSS頁面
body{
background-color: lightgray;
}
.content ul{
padding-left: 0;
}
.content ul li{
display: inline-block;
}
.content{
width: 1000px;
margin: 0 auto;
}
.content .banner img{
width: 1000px;
}
.content .star{
margin-top: 20px;
}
.content .star .title{
background-image: url(../img/zhuxing.png);
background-repeat: no-repeat;
height: 45px;
}
.content .star li{
background-color: white;
vertical-align: bottom;
height: 135px;
/* vertical-align: bottom;底部對齊 */
}
.content .star li span{
color: #999999;
font-size: 12px;
}
.content .star li img{
width: 180px;
}
.content .star li:last-child{
margin-left: 20px;
width: 240px;
}
.content .star li:last-child img{
height: 135px;
width: 240px;
}
.content .star li span{
padding: 10px;
text-align: center;
display: block;
}
.content .top{
margin-top: 20px;
}
.content .top .title{
height: 25px;
background-image: url(../img/shop_title2.png);
background-repeat: no-repeat;
background-position: 0px -60px;
}
.content .top li{
margin: 0 3px;
width: 115px;
background-color: white;
text-align: center;
}
.content .top li a{
text-decoration: none;
color: #000000;
font-size: 12px;
font-weight: bold;
}
.content .top li:first-child{
margin-left: 0;
}
.content .top li:last-child{
margin-right: 0;
}
.content .top img{
width: 115px;
}
.content .list .title2{
height: 45px;
background-image: url(../img/shop_title2.png);
background-repeat: no-repeat;
background-position: 0px -103px;
}
.content .list li{
background-color: white;
width: 323px;
height: 154px;
margin: 10px 5px;
}
.content .list li:nth-child(3n+1){
margin-left: 0;
}
.content .list li:nth-child(3n){
margin-right: 0;
}
.content .list img{
width: 154px;
height: 154px;
}
.content .list .right{
display: inline-block;
vertical-align: top;
}
.content .list .right span{
display: block;
color: #999999;
margin: 10px 5px;
width: 150px;
font-size: 12px;
}
.content .list .right .title{
margin-top: 30px;
display: block;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
}
.content .list .right .money{
color: #D34462;
}
.content .list .right div{
margin-top: -10px;
}
.content .list .right div span{
display: inline-block;
}
.content .list .right .love{
width: 12px;
height: 12px;
background-image: url(../img/icon/ico.png);
background-repeat: no-repeat;
background-position: 0px -72px;
margin-top: 13px;
}
.content .list .right .num{
width: 100px;
vertical-align: top;
}
.tubiao{
text-align: center;
background-color: white;
height: 53px;
}
.tubiao img{
width: 1100px;
}
1、vertical-align
.content .star li{
background-color: white;
vertical-align: bottom;
height: 135px;
/* vertical-align: bottom;底部對齊 */
}
vertical-align: bottom; 底部對齊
vertical-align: top; 頂部對齊
vertical-align: bottom; 水平對齊
2.超過文字設定的寬度顯示省略號
.content .list .right .title{
margin-top: 30px;
display: block;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2; //瀏覽器的相容
line-clamp: 2;
-webkit-box-orient: vertical;
}
3.背景圖片(精靈圖)
background-image: url(../img/icon/ico.png); //背景圖片
background-repeat: no-repeat; //背景圖片不平鋪
background-position: 0px -72px; //背景圖片的位置