您的位置:首页 > Web前端 > CSS

用CSS画个三角形

2016-05-28 13:41 701 查看
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#trangle {
display: inline-block;
width: 200px;
height: 200px;
border-left: 100px solid #333;
border-right: 100px solid #678;
border-top: 100px solid #91b;
border-bottom: 100px solid #eee;
}
</style>
</head>
<body>
<span id="trangle"></span>
</body>
</html>




<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#trangle {
display: inline-block;
border-left: 100px solid #333;
border-right: 100px solid #678;
border-top: 100px solid #91b;
}
</style>
</head>
<body>
<span id="trangle"></span>
</body>
</html>




<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#trangle {
display: inline-block;
border-left: 100px solid transparent;
border-right: 100px solid transparent;
border-top: 100px solid #91b;
}
</style>
</head>
<body>
<span id="trangle"></span>
</body>
</html>




把两边设置transparent透明就可以l,利用border的特性
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: