内容简介:由张鑫旭大佬的几篇文章
由张鑫旭大佬的几篇文章
发现了border,border-radius, box-shadow一些特殊用法,由此想到自己做个总结。
border
只写一条边
.triangle {
width: 100px;
border-top: 100px solid red;
}
同理可得其他边。
写border,同时只写一条边
top
.triangle {
width: 100px;
border: 100px solid black;
border-top: 100px solid red;
}
left
.triangle {
width: 100px;
border: 100px solid black;
border-left: 100px solid red;
}
写border,同时写两条边
.triangle {
width: 100px;
border: 100px solid black;
border-top: 100px solid red;
border-bottom: 100px solid blue;
}
由此基本可以看出四条边的组成情况,在此基础上就可以做出各种变形。比如,文章中提到的 向下三角, 梯形等
boder-radius
应用一条边
top
.triangle {
width: 100px;
border: 100px solid black;
border-top: 100px solid red;
border-radius: 200px 0 0 0;
}
.triangle {
width: 50px;
height: 50px;
border-top: 10px solid red;
border-radius: 200px 0 0 0;
}
镂空
.triangle {
width: 50px;
height: 50px;
border: 50px solid black;
border-radius: 50px 0 0 0;
}
应用两条边
.triangle {
width: 50px;
height: 50px;
border-top: 10px solid red;
border-left: 10px solid yellow;
border-radius: 100px;
}
应用四条边
圆环
.triangle {
width: 50px;
height: 50px;
border-top: 10px solid red;
border-radius: 100px;
}
border-radius完整结构
border-radius: 1-4 length|% / 1-4 length|%;
“/” 前的四个数值表示圆角的水平半径,后面四个值表示圆角的垂直半径:
鹅蛋
.triangle {
width: 50px;
height: 50px;
background: lightpink;
border-bottom: 10px solid blue;
border-left: 10px solid yellow;
border-right: 10px solid black;
border-top: 10px solid red;
border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}
box-shadow
.triangle {
width: 50px;
height: 50px;
background: lightpink;
box-shadow: 50px 50px 0 0 purple;
}
以上所述就是小编给大家介绍的《CSS图形绘制总结》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
XML Hacks
Michael Fitzgerald / O'Reilly Media, Inc. / 2004-07-27 / USD 24.95
Developers and system administrators alike are uncovering the true power of XML, the Extensible Markup Language that enables data to be sent over the Internet from one computer platform to another or ......一起来看看 《XML Hacks》 这本书的介绍吧!