目标制作:
步骤:
1,设置总体的div和插入图片
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>s商品</title>
<style>
/* 共有标签去掉内外间距 */
*{
margin: 0;
padding: 0;
}
a{
/* 去掉a标签的样式 */
text-decoration: none;
}
/* 去掉ul,ol的样式 */
ul,ol{
list-style: none;
}
.goods{
width: 255px;
height: 390px;
border: 1px solid red;
}
/* 设置图片的大小 */
.goods>.dd>img{
width: 250px;
height: 255px;
}
</style>
</head>
<body>
<div class="goods">
<div class="dd">
<img src="img/22.jpg_.webp.jpg" alt="这是一个图片">
<div>
</div>
</div>
</div>
</body>
</html>
2, 设置图标
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>s商品</title>
<style>
/* 共有标签去掉内外间距 */
*{
margin: 0;
padding: 0;
}
a{
/* 去掉a标签的样式 */
text-decoration: none;
}
/* 去掉ul,ol的样式 */
ul,ol{
list-style: none;
}
.goods{
width: 255px;
height: 390px;
border: 1px solid red;
}
/* 设置图片的大小 */
.goods>.dd>img{
width: 250px;
height: 255px;
}
.dd{
width: 255px;
height: 255px;
}
.intro{
width: 255px;
height: 25px;
background-color: orange;
/* 绝对定位,子级绝对点位,父级一定是相对定位 */
position: absolute;
left: 0;
right: 0;
bottom: -2px;
/* 本身不出来,当hover的时候才出来 */
}
</style>
</head>
<body>
<div class="goods">
<div class="dd">
<img src="img/22.jpg_.webp.jpg" alt="这是一个图片">
<div class="intro">
<div class="intro-left"><a href="">找同款</a></div>
<div class="intro-right"><a href="">找相似</a></div>
</div>
<div>
</div>
</div>
</div>
</body>
</html>
3,设置绝对,相对定位,左浮动和右浮动
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>商品</title>
<style>
/* 共有标签去掉内外间距 */
*{
margin: 0;
padding: 0;
}
/* 因为超链接a的字体是白色 */
a{
color: white;
/* 去掉a标签的样式 */
text-decoration: none;
}
/* 去掉ul,ol的样式 */
ul,ol{
list-style: none;
}
.goods{
width: 255px;
height: 390px;
border: 1px solid red;
}
/* 设置图片的大小 */
.goods>.dd>img{
width: 255px;
height: 255px;
}
.dd{
width: 255px;
height: 255px;
position: relative;
}
.intro{
width: 255px;
height: 25px;
background-color: orange;
/* 绝对定位,子级绝对点位,父级一定是相对定位 */
position: absolute;
left: 0;
right: 0;
bottom: -2px;
/* 本身不出来,当hover的时候才出来 */
display: none;
}
.goods>.dd:hover>.intro{
display:block ;
}
.intro-left{
width: 130px;
height: 25px;
float: left;
line-height:25px ;
text-align: center;
}
.intro-right{
width: 125px;
height: 25px;
float: left;
line-height:25px ;
text-align: center;
}
.price{
color: orange;
font-size: 20px;
}
/* 伪元素 */
.price::after{
content:'包邮' ;
color: orange;
font-size: 14px;
display: inline-block;
margin-left: 6px;
}
.count{
color: black;
font-size: 14px;
float: right;
display: inline-block;
margin-top:10px;
margin-right:10px;
}
.title>a{
color: #333;
font-size: 12px;
}
.title>a:hover{
color: orange;
text-align: underline;
}
p.color{
color: #999;
}
.title>img{
/* 图标居中 */
vertical-align:middle ;
display: inline-block;
margin-top:1px;
}
</style>
</head>
<body>
<div class="goods">
<div class="dd">
<img src="img/22.jpg_.webp.jpg" alt="这是图片">
<div class="intro">
<div class="intro-left"><a href="">找同款</a></div>
<div class="intro-right"><a href="">找相似</a></div>
</div>
</div>
<p>
<span class="price">¥128.00</span>
<span class="count">10万人付款</span>
</p>
<p class="title color"><a href="#">【欧阳娜娜同款】Ubras无尺码背心式文胸无痕无钢圈内衣女士胸罩
舒服到飞起的飞机Bra,高性价比,全网热销</a></p>
<p class="title"><img src="img/88888.png" alt="这是一个图片">
<a href="">ubras内衣旗舰店</a>
</p>
</div>
</body>
</html>
4,设置hover效果和display的属性
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>s商品</title>
<style>
/* 共有标签去掉内外间距 */
*{
margin: 0;
padding: 0;
}
a{
color: white;
/* 去掉a标签的样式 */
text-decoration: none;
}
/* 去掉ul,ol的样式 */
ul,ol{
list-style: none;
}
.goods{
width: 255px;
height: 390px;
border: 1px solid red;
}
/* 设置图片的大小 */
.goods>.dd>img{
width: 250px;
height: 255px;
}
.dd{
width: 255px;
height: 255px;
position: relative;
}
.intro{
width: 255px;
height: 25px;
background-color: orange;
/* 绝对定位,子级绝对点位,父级一定是相对定位 */
position: absolute;
left: 0;
right: 0;
bottom: -2px;
/* 本身不出来,当hover的时候才出来 */
position: absolute;
display: none;
}
.goods>.dd:hover>.intro{
display:block ;
}
.intro-left{
width: 130px;
height: 25px;
float: left;
line-height:25px ;
text-align: center;
}
.intro-right{
width: 125px;
height: 25px;
float: left;
line-height:25px ;
text-align: center;
}
.intro-left>a{
font-weight: bold;
}
.intro-right>a{
font-weight: bold;
}
</style>
</head>
<body>
<div class="goods">
<div class="dd">
<img src="img/22.jpg_.webp.jpg" alt="这是一个图片">
<div class="intro">
<div class="intro-left"><a href="">找同款</a></div>
<div class="intro-right"><a href="">找相似</a></div>
</div>
<div>
</div>
</div>
</div>
</body>
</html>
5, 加文字
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>s商品</title>
<style>
/* 共有标签去掉内外间距 */
*{
margin: 0;
padding: 0;
}
a{
color: white;
/* 去掉a标签的样式 */
text-decoration: none;
}
/* 去掉ul,ol的样式 */
ul,ol{
list-style: none;
}
.goods{
width: 255px;
height: 390px;
border: 1px solid red;
}
/* 设置图片的大小 */
.goods>.dd>img{
width: 250px;
height: 255px;
}
.dd{
width: 255px;
height: 255px;
position: relative;
}
.intro{
width: 255px;
height: 25px;
background-color: orange;
/* 绝对定位,子级绝对点位,父级一定是相对定位 */
position: absolute;
left: 0;
right: 0;
bottom: -2px;
/* 本身不出来,当hover的时候才出来 */
position: absolute;
display: none;
}
.goods>.dd:hover>.intro{
display:block ;
}
.intro-left{
width: 130px;
height: 25px;
float: left;
line-height:25px ;
text-align: center;
}
.intro-right{
width: 125px;
height: 25px;
float: left;
line-height:25px ;
text-align: center;
}
.intro-left>a{
font-weight: bold;
}
.intro-right>a{
font-weight: bold;
}
.price{
color: orange;
font-size: 20px;
}
/* 伪元素 */
.price::after{
content:'包邮' ;
color: orange;
font-size: 14px;
display: inline-block;
margin-left: 6px;
}
.count{
color: black;
font-size: 14px;
float: right;
display: inline-block;
margin-top:10px;
margin-right:10px;
}
.title>a{
color: #333;
font-size: 12px;
}
.title>a:hover{
color: orange;
text-align: underline;
}
p.color{
color: #999;
}
</style>
</head>
<body>
<div class="goods">
<div class="dd">
<img src="img/22.jpg_.webp.jpg" alt="这是一个图片">
<div class="intro">
<div class="intro-left"><a href="">找同款</a></div>
<div class="intro-right"><a href="">找相似</a></div>
</div>
<div>
<p>
<span class="price">¥128.00</span>
<span class="count">10万人付款</span>
</p>
<p class="title color"><a href="#">【欧阳娜娜同款】Ubras无尺码背心式文胸无痕无钢圈内衣女士胸罩
舒服到飞起的飞机Bra,高性价比,全网热销</a></p>
</div>
</div>
</div>
</body>
</html>
6,处理剩下商品信息的内容
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>商品</title>
<style>
/* 共有标签去掉内外间距 */
*{
margin: 0;
padding: 0;
}
/* 因为超链接a的字体是白色 */
a{
color: white;
/* 去掉a标签的样式 */
text-decoration: none;
}
/* 去掉ul,ol的样式 */
ul,ol{
list-style: none;
}
.goods{
width: 257px;
height: 390px;
}
/* 设置图片的大小 */
.goods>.dd>img{
width: 257px;
height: 255px;
}
.dd{
width: 257px;
height: 255px;
position: relative;
}
.intro{
width: 257px;
height: 25px;
background-color: orange;
/* 绝对定位,子级绝对点位,父级一定是相对定位 */
position: absolute;
left: 0;
right: 0;
bottom: -2px;
/* 本身不出来,当hover的时候才出来 */
display: none;
}
.goods>.dd:hover>.intro{
display:block ;
}
.intro-left{
width: 130px;
height: 25px;
float: left;
line-height:25px ;
text-align: center;
}
.intro-right{
width: 125px;
height: 25px;
float: left;
line-height:25px ;
text-align: center;
}
.price{
color: orange;
font-size: 20px;
}
/* 伪元素 */
.price::after{
content:'包邮' ;
color: orange;
font-size: 14px;
display: inline-block;
margin-left: 6px;
}
.count{
color: black;
font-size: 14px;
float: right;
display: inline-block;
margin-top:10px;
margin-right:10px;
}
.title>a{
color: #333;
font-size: 12px;
}
.title>a:hover{
color: orange;
text-align: underline;
}
p.color{
color: #999;
}
.title>img{
/* 图标居中 */
vertical-align:middle ;
display: inline-block;
margin-top:1px;
}
.n1{
display: inline-block;
margin-left:85px ;
font-size: 12px;
color: #333;
}
.n2{
display: inline-block;
margin-left: 3px;
font-size: 12px;
color: #333;
}
.cls2{
float: right;
display: inline-block;
margin-right: 9px;
}
.cls1{
display: inline-block;
margin-left: 9px;
}
.windows{
width: 255px;
height: 135px;
border: 1px solid #999999;
}
</style>
</head>
<body>
<div class="goods">
<div class="dd">
<img src="img/22.jpg_.webp.jpg" alt="这是图片">
<div class="intro">
<div class="intro-left"><a href="">找同款</a></div>
<div class="intro-right"><a href="">找相似</a></div>
</div>
</div>
<div class="windows">
<p>
<span class="price">¥128.00</span>
<span class="count">10万人付款</span>
</p>
<p class="title color"><a href="#">【欧阳娜娜同款】Ubras无尺码背心式文胸无痕无钢圈内衣女士胸罩
舒服到飞起的飞机Bra,高性价比,全网热销</a></p>
<p class="title"><img src="img/88888.png" alt="这是一个图片">
<a href="">ubras内衣旗舰店</a>
<span class="n1">江苏</span>
<span class="n2">无锡</span>
</p>
<div class="cls">
<div class="cls1"><a href=""><img src="img/99.png" alt="这是一个图片"></a></div>
<div class="cls2"><a href=""><img src="img/00.png" alt="这是一个图片"></a></div>
</div>
</div>
</div>
</body>
</html>
7,商品在页面的布局
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>商品</title>
<style>
/* 共有标签去掉内外间距 */
*{
margin: 0;
padding: 0;
}
/* 因为超链接a的字体是白色 */
a{
color: white;
/* 去掉a标签的样式 */
text-decoration: none;
}
/* 去掉ul,ol的样式 */
ul,ol{
list-style: none;
}
.goods{
width: 257px;
height: 390px;
float: left;
margin: 2px;
floa
}
/* 设置图片的大小 */
.goods>.dd>img{
width: 257px;
height: 255px;
}
.dd{
width: 257px;
height: 255px;
position: relative;
}
.intro{
width: 257px;
height: 25px;
background-color: orange;
/* 绝对定位,子级绝对点位,父级一定是相对定位 */
position: absolute;
left: 0;
right: 0;
bottom: -2px;
/* 本身不出来,当hover的时候才出来 */
display: none;
}
.goods>.dd:hover>.intro{
display:block ;
}
.intro-left{
width: 130px;
height: 25px;
float: left;
line-height:25px ;
text-align: center;
}
.intro-right{
width: 125px;
height: 25px;
float: left;
line-height:25px ;
text-align: center;
}
.price{
color: orange;
font-size: 20px;
}
/* 伪元素 */
.price::after{
content:'包邮' ;
color: orange;
font-size: 14px;
display: inline-block;
margin-left: 6px;
}
.count{
color: black;
font-size: 14px;
float: right;
display: inline-block;
margin-top:10px;
margin-right:10px;
}
.title>a{
color: #333;
font-size: 12px;
}
.title>a:hover{
color: orange;
text-align: underline;
}
p.color{
color: #999;
}
.title>img{
/* 图标居中 */
vertical-align:middle ;
display: inline-block;
margin-top:1px;
}
.n1{
display: inline-block;
margin-left:85px ;
font-size: 12px;
color: #333;
}
.n2{
display: inline-block;
margin-left: 3px;
font-size: 12px;
color: #333;
}
.cls2{
float: right;
display: inline-block;
margin-right: 9px;
}
.cls1{
display: inline-block;
margin-left: 9px;
}
.windows{
width: 255px;
height: 135px;
border: 1px solid #999999;
}
.content{
width: 1300px;
height: 2000px;
margin: auto;
border: 1px solid red;
}
</style>
</head>
<body>
<div class="content">
<div class="goods">
<div class="dd">
<img src="img/22.jpg_.webp.jpg" alt="这是图片">
<div class="intro">
<div class="intro-left"><a href="">找同款</a></div>
<div class="intro-right"><a href="">找相似</a></div>
</div>
</div>
<div class="windows">
<p>
<span class="price">¥128.00</span>
<span class="count">10万人付款</span>
</p>
<p class="title color"><a href="#">【欧阳娜娜同款】Ubras无尺码背心式文胸无痕无钢圈内衣女士胸罩
舒服到飞起的飞机Bra,高性价比,全网热销</a></p>
<p class="title"><img src="img/88888.png" alt="这是一个图片">
<a href="">ubras内衣旗舰店</a>
<span class="n1">江苏</span>
<span class="n2">无锡</span>
</p>
<div class="cls">
<div class="cls1"><a href=""><img src="img/99.png" alt="这是一个图片"></a></div>
<div class="cls2"><a href=""><img src="img/00.png" alt="这是一个图片"></a></div>
</div>
</div>
</div>
<div class="goods">
<div class="dd">
<img src="img/22.jpg_.webp.jpg" alt="这是图片">
<div class="intro">
<div class="intro-left"><a href="">找同款</a></div>
<div class="intro-right"><a href="">找相似</a></div>
</div>
</div>
<div class="windows">
<p>
<span class="price">¥128.00</span>
<span class="count">10万人付款</span>
</p>
<p class="title color"><a href="#">【欧阳娜娜同款】Ubras无尺码背心式文胸无痕无钢圈内衣女士胸罩
舒服到飞起的飞机Bra,高性价比,全网热销</a></p>
<p class="title"><img src="img/88888.png" alt="这是一个图片">
<a href="">ubras内衣旗舰店</a>
<span class="n1">江苏</span>
<span class="n2">无锡</span>
</p>
<div class="cls">
<div class="cls1"><a href=""><img src="img/99.png" alt="这是一个图片"></a></div>
<div class="cls2"><a href=""><img src="img/00.png" alt="这是一个图片"></a></div>
</div>
</div>
</div>
<div class="goods">
<div class="dd">
<img src="img/22.jpg_.webp.jpg" alt="这是图片">
<div class="intro">
<div class="intro-left"><a href="">找同款</a></div>
<div class="intro-right"><a href="">找相似</a></div>
</div>
</div>
<div class="windows">
<p>
<span class="price">¥128.00</span>
<span class="count">10万人付款</span>
</p>
<p class="title color"><a href="#">【欧阳娜娜同款】Ubras无尺码背心式文胸无痕无钢圈内衣女士胸罩
舒服到飞起的飞机Bra,高性价比,全网热销</a></p>
<p class="title"><img src="img/88888.png" alt="这是一个图片">
<a href="">ubras内衣旗舰店</a>
<span class="n1">江苏</span>
<span class="n2">无锡</span>
</p>
<div class="cls">
<div class="cls1"><a href=""><img src="img/99.png" alt="这是一个图片"></a></div>
<div class="cls2"><a href=""><img src="img/00.png" alt="这是一个图片"></a></div>
</div>
</div>
</div>
<div class="goods">
<div class="dd">
<img src="img/22.jpg_.webp.jpg" alt="这是图片">
<div class="intro">
<div class="intro-left"><a href="">找同款</a></div>
<div class="intro-right"><a href="">找相似</a></div>
</div>
</div>
<div class="windows">
<p>
<span class="price">¥128.00</span>
<span class="count">10万人付款</span>
</p>
<p class="title color"><a href="#">【欧阳娜娜同款】Ubras无尺码背心式文胸无痕无钢圈内衣女士胸罩
舒服到飞起的飞机Bra,高性价比,全网热销</a></p>
<p class="title"><img src="img/88888.png" alt="这是一个图片">
<a href="">ubras内衣旗舰店</a>
<span class="n1">江苏</span>
<span class="n2">无锡</span>
</p>
<div class="cls">
<div class="cls1"><a href=""><img src="img/99.png" alt="这是一个图片"></a></div>
<div class="cls2"><a href=""><img src="img/00.png" alt="这是一个图片"></a></div>
</div>
</div>
</div>
<div class="goods">
<div class="dd">
<img src="img/22.jpg_.webp.jpg" alt="这是图片">
<div class="intro">
<div class="intro-left"><a href="">找同款</a></div>
<div class="intro-right"><a href="">找相似</a></div>
</div>
</div>
<div class="windows">
<p>
<span class="price">¥128.00</span>
<span class="count">10万人付款</span>
</p>
<p class="title color"><a href="#">【欧阳娜娜同款】Ubras无尺码背心式文胸无痕无钢圈内衣女士胸罩
舒服到飞起的飞机Bra,高性价比,全网热销</a></p>
<p class="title"><img src="img/88888.png" alt="这是一个图片">
<a href="">ubras内衣旗舰店</a>
<span class="n1">江苏</span>
<span class="n2">无锡</span>
</p>
<div class="cls">
<div class="cls1"><a href=""><img src="img/99.png" alt="这是一个图片"></a></div>
<div class="cls2"><a href=""><img src="img/00.png" alt="这是一个图片"></a></div>
</div>
</div>
</div>
<div class="goods">
<div class="dd">
<img src="img/22.jpg_.webp.jpg" alt="这是图片">
<div class="intro">
<div class="intro-left"><a href="">找同款</a></div>
<div class="intro-right"><a href="">找相似</a></div>
</div>
</div>
<div class="windows">
<p>
<span class="price">¥128.00</span>
<span class="count">10万人付款</span>
</p>
<p class="title color"><a href="#">【欧阳娜娜同款】Ubras无尺码背心式文胸无痕无钢圈内衣女士胸罩
舒服到飞起的飞机Bra,高性价比,全网热销</a></p>
<p class="title"><img src="img/88888.png" alt="这是一个图片">
<a href="">ubras内衣旗舰店</a>
<span class="n1">江苏</span>
<span class="n2">无锡</span>
</p>
<div class="cls">
<div class="cls1"><a href=""><img src="img/99.png" alt="这是一个图片"></a></div>
<div class="cls2"><a href=""><img src="img/00.png" alt="这是一个图片"></a></div>
</div>
</div>
</div>
<div class="goods">
<div class="dd">
<img src="img/22.jpg_.webp.jpg" alt="这是图片">
<div class="intro">
<div class="intro-left"><a href="">找同款</a></div>
<div class="intro-right"><a href="">找相似</a></div>
</div>
</div>
<div class="windows">
<p>
<span class="price">¥128.00</span>
<span class="count">10万人付款</span>
</p>
<p class="title color"><a href="#">【欧阳娜娜同款】Ubras无尺码背心式文胸无痕无钢圈内衣女士胸罩
舒服到飞起的飞机Bra,高性价比,全网热销</a></p>
<p class="title"><img src="img/88888.png" alt="这是一个图片">
<a href="">ubras内衣旗舰店</a>
<span class="n1">江苏</span>
<span class="n2">无锡</span>
</p>
<div class="cls">
<div class="cls1"><a href=""><img src="img/99.png" alt="这是一个图片"></a></div>
<div class="cls2"><a href=""><img src="img/00.png" alt="这是一个图片"></a></div>
</div>
</div>
</div>
<!-- 清除浮动对兄弟节点的影响,浮动一般会影响平行级别的块元素或者文字 -->
<div style="clear:both"></div>
<p>介绍内衣,介绍内衣,介绍内衣,介绍内衣,介绍内衣,介绍内衣,介绍内衣,介绍内衣,介绍内衣,介绍内衣,介绍内衣,介绍内衣,介绍内衣,介绍内衣,介绍内衣,介绍内衣,介绍内衣,介绍内衣,介绍内衣,介绍内衣,介绍内衣,介绍内衣,</p>
</div>
</body>
</html>