使⽤css3在⽹页中实现各种三⾓形样式集合(原理解析)
⼤家在浏览web⽹页的时候经常看到有各种各样的图形,⽐如圆形,正⽅形,长⽅形,三⾓形等,今天特意做了⼀个关于⽤CSS实现三⾓形的教程,那css三⾓形怎么写呢?css实现三⾓形的原理是什么?
请看⼀下实例详解。
css3三⾓形使⽤场景
我们知道有⼀个特效是span下拉列表,也就是说当⿏标放上⼀个div时,会出现原本隐藏的内容或者⼆级菜单,这样⼀个下拉列表会突出来⼀个⼩的三⾓形指向原本的div区域块,如图所⽰:
那么我们现在来总结⼀下,我们是如何写出这些三⾓形的。
中考成绩查询
CSS3三⾓形实现原理
在css3中,我们主要使⽤的是⼀个transparent的属性,意思是透明的,⽐如我们将字体设置为⿊⾊会写color:black,那么如果想把字体的颜⾊设置为透明,我们可以写color:transparent。同理background-color:transparent可以设置背景为透明。
三⾓形8种分类
我们根据三⾓形的位置分为8种:
1triangle up,triangle down,triangle left,triangle right,triangle top left,triangle top right,triangle bottom left和triangle bottom right。
8种三⾓形实现实例
height:0;
信息化管理平台
border-left:50pxsolidtransparent;
border-right:50pxsolidtransparent;
border-bottom:100pxsolidblack;
风景画怎么画}
用粘土做泥#triangle-down{
width:0;
height:0;
border-left:50pxsolidtransparent;
border-right:50pxsolidtransparent;
border-top:100pxsolidblack;
}
临江王
#triangle-left{
width:0;
height:0;
border-top:50pxsolidtransparent;
border-bottom:50pxsolidtransparent;
border-right:100pxsolidblack;
}
height:0;
border-top:50pxsolidtransparent;
border-bottom:50pxsolidtransparent;
border-left:100pxsolidblack;
}
触电应急演练方案
#triangle-topleft{
width:0;
height:0;
border-top:100pxsolidblack;
border-right:100pxsolidtransparent;
执策而临之}
#triangle-topright{
width:0;
height:0;
border-top:100pxsolidblack;
border-left:100pxsolidtransparent;
}
#triangle-bottomleft{
width:0;
两元height:0;
border-bottom:100pxsolidblack;
border-right:100pxsolidtransparent;
}
#triangle-bottomright{
width:0;
height:0;
border-bottom:100pxsolidblack;
border-left:100pxsolidtransparent;
}
⼤致的效果如图所⽰:
以上就是使⽤css3在⽹页中实现各种三⾓形样式集合(原理解析)的详细内容,更多请关注我