例1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
.box {
width: 700px;
height: 120px;
position: relative;
margin: 100px auto;
border: 1px solid #000000
}
.title {
height: 30px;
position: absolute;
top: -15px;
left: 10px;
font-size: 14px;
line-height: 30px;
padding: 0 10px;
background-color: #FFFFFF;
}
.content {
width: 680px;
margin: 20px 10px;
background-color: pink;
}
.content img {
width: 80px;
height: 80px;
float: left;
}
.text {
margin-left: 95px;
font-size: 12px;
}
.text p {
margin-top: 5px;
}
.clearfix:after {
content: "";
display: block;
clear: both;
}
.clearfix {
zoom: 1;
}
</style>
</style>
</style>
</head>
<body>
<div class="box">
<h3 class="title">关于我们</h3>
<div class="content">
<img src="photo.jpg" alt="">
<div class="text clearfix">
<p>123</p>
<p>123</p>
<p>123</p>
<p>123</p>
</div>
</div>
</div>
</body>
</html>
![](https://img.haomeiwen.com/i6323555/98591d26f50cde3e.jpg)
例2
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
li {
list-style: none;
}
a {
text-decoration: none;
}
.list {
width: 450px;
height: 35px;
margin: 100px auto;
font-size: 16px;
text-align: center;
font-family: "Microsoft YaHei", "微软雅黑";
border-top: 1px solid #4B91F3;
border-right: 1px solid #4B91F3;
border-bottom: 4px solid #4B91F3;
}
.list li {
float: left;
border-left: 1px solid #4B91F3;
}
.list li a {
width: 74px;
height: 35px;
position: relative;
color: #4B91F3;
line-height: 35px;
display: inline-block;
}
.list li a:hover {
color: #FFFFFF;
background-color: #4B91F3;
}
/* 三角形 */
.list li a i {
width: 0;
height: 0;
position: absolute;
left: 50%;
bottom: 0;
/* border-width:5px,即三角形的宽高各位10px*/
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: transparent transparent #4B91F3 transparent;
display: none;
}
.list .active a i {
display: block;
}
</style>
</style>
</style>
</head>
<body>
<ul class="list">
<li class="active"><a href="#">首页<i></i></a></li>
<li><a href="#">视频<i></i></a></li>
<li><a href="#">前瞻<i></i></a></li>
<li><a href="#">攻略<i></i></a></li>
<li><a href="#">评测<i></i></a></li>
<li><a href="#">网游<i></i></a></li>
</ul>
</body>
</html>
![](https://img.haomeiwen.com/i6323555/2b39bd98c9fb9721.jpg)
例3
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
.box {
width: 80px;
margin: 100px auto;
position: relative;
border: 1px solid #000000;
}
.box img {
height: 80px;
/* 去除图片下边距 */
vertical-align: top;
}
.tag {
width: 40px;
height: 20px;
position: absolute;
top: 0;
right: -8px;
color: #FFFFFF;
text-align: center;
line-height: 20px;
background-color: #EE3030;
}
/* 标签下的三角阴影 */
.tag i {
width: 0;
height: 0;
position: absolute;
top: 100%;
right: -8px;
border-width: 0 8px 8px;
border-style: solid;
border-color: transparent transparent transparent #7E1818;
}
</style>
</style>
</style>
</head>
<body>
<div class="box">
<img src="photo.jpg" alt="" />
<span class="tag">标签<i></i></span>
</div>
</body>
</html>
![](https://img.haomeiwen.com/i6323555/29aa1185be8fd4ad.jpg)
网友评论