目录
1.盒子用ps裁量案例
最后运行的效果为:
练习代码为:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
margin: 0;
padding: 0;
}
img{
/* 转换图片类型 图片和文字之间就没有缝隙了 */
display: block;
}
#box{
width: 241px;
height: 335px;
/* background: yellow; */
margin: 0 auto;
padding: 11px 11px 18px;
}
.title{
width: 235px;
height: 19px;
/* background: red; */
padding-left: 4px;
border-left: 2px solid #254291;
color: #254291;
line-height: 19px;
font-size: 14px;
font-weight: bold;
margin-bottom: 14px;
}
.bigpic{
width: 241px;
height: 170px;
margin-bottom: 16px;
}
.bigpic p{
width: 241px;
height: 26px;
background-color: #f6f7f8;
font-size: 12px;
text-align: center;
line-height: 26px;
}
.smallpic{
width: 241px;
height: 120px;
}
.smallpic p {
font-size: 12px;
width: 112px;
background-color: #f6f7f8;
line-height: 18px;
}
.left{
float: left;
}
.right{
float: right;
}
</style>
</head>
<body>
<div id="box">
<div class="title">
女人图片
</div>
<div class="bigpic">
<img src="img/big.jpg" alt="大姐">
<p>大姐利用废物联盟经营美容院</p>
</div>
<div class="smallpic">
<div class="left">
<img src="img/smill1.jpg" alt="图1">
<p>无效化妆无效穿搭≠容貌焦虑</p>
</div>
<div class="right">
<img src="img/smill2.jpg" alt="图2">
<p>小个子不要怕!“高人一等”的穿搭给你</p>
</div>
</div>
</div>
</body>
</html>
2.二级菜单案例
练习结果为:
练习代码为:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
/*
选择器
.item>ul (>)亲儿子选择器
.item ul (空格)后代选择器
*/
*{
padding: 0;
margin: 0;
}
.box{
width: 300px;
margin: 0 auto;
}
ul{
list-style: none;
}
.box .item{
float: left;
width: 148px;
text-align: center;
line-height: 40px;
border: 1px solid blue;
background-color: blue;
color: white;
height: 40px;
}
.item:hover{
background: lightblue;
}
.item ul{
display: none;
background: white;
color: black;
}
.item:hover ul{
display: block;
}
.item li:hover{
color: blue;
}
</style>
</head>
<body>
<ul class="box">
<li class="item">视频教程
<ul>
<li>全部视频教程</li>
<li>html5视频教程</li>
<li>java视频教程</li>
<li>python视频教程</li>
</ul>
</li>
<li class="item">认证考试
<ul>
<li>pmp</li>
<li>红帽</li>
</ul>
</li>
</ul>
</body>
</html>