随笔 - 119  文章 - 0  评论 - 5  阅读 - 57389

CSS三角

CSS三角

.box1 {
width: 0;
height: 0;
/* border: 10px solid pink; */
border-top: 10px solid pink;
border-right: 10px solid red;
border-bottom: 10px solid blue;
border-left: 10px solid green;
}

.box2 {
width: 0;
height: 0;
border: 50px solid transparent;
border-left-color: pink;
margin: 100px auto;
}

.jd {
position: relative;
width: 120px;
height: 249px;
background-color: pink;
}
.jd span {
position: absolute;
right: 15px;
top: -10px;
width: 0;
height: 0;
/* 为了照顾兼容性 */
line-height: 0;
font-size: 0;
border: 5px solid transparent;
border-bottom-color: pink;
}

CSS三角强化

*{
margin: 0;
padding: 0;
}
.box{
width: 0;
height: 0;
border: 100px solid transparent;
border-bottom-color: blue;
}
.box1{
float: left;
border-top: 200px solid transparent;
border-right: 100px solid blue;
border-bottom: 0 solid transparent;
border-left: 0 solid transparent;
}

*{
margin: 0;
padding: 0;
}
.box{
width: 0;
height: 0;
border: 100px solid transparent;
border-bottom-color: green;
}
.box1{
float: left;
border-top: 200px solid transparent;
border-right: 50px solid brown;
border-bottom: 0 solid transparent;
border-left: 0 solid transparent;
margin-left: 50px;
}
.box2{
float: left;
border-top: 200px solid transparent;
border-right: 0 solid transparent;
border-bottom: 0 solid transparent;
border-left: 50px solid brown;
}

或者

*{
margin: 0;
padding: 0;
}
.box{
width: 0;
height: 0;
border: 100px solid transparent;
border-bottom-color: green;
}
.box1{
float: left;
border-color: transparent brown transparent transparent;
border-style: solid;
border-width: 200px 50px 0 0;
margin-left: 50px;
}
.box2{
float: left;
border-color: transparent transparent transparent brown;
border-style: solid;
border-width: 200px 0 0 50px;
}
posted on   cookie的笔记簿  阅读(48)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· AI 智能体引爆开源社区「GitHub 热点速览」
· 写一个简单的SQL生成工具
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示