资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

纯CSS怎么实现页面的尖角、小三角、不同方向尖角

这篇文章给大家分享的是有关纯CSS怎么实现页面的尖角、小三角、不同方向尖角的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

成都网站设计、成都网站建设、外贸网站建设的开发,更需要了解用户,从用户角度来建设网站,获得较好的用户体验。创新互联公司多年互联网经验,见的多,沟通容易、能帮助客户提出的运营建议。作为成都一家网络公司,打造的就是网站建设产品直销的概念。选择创新互联公司,不只是建站,我们把建站作为产品,不断的更新、完善,让每位来访用户感受到浩方产品的价值服务。

效果图:

方法一的效果图:

纯CSS怎么实现页面的尖角、小三角、不同方向尖角

方法二的效果图:

纯CSS怎么实现页面的尖角、小三角、不同方向尖角

方法三的效果图:

纯CSS怎么实现页面的尖角、小三角、不同方向尖角

方法1:因为有背景,所有实现起来比较方便,尖角的内部同个颜色就可以不用考虑遮挡问题

html:

  

带背景颜色的小三角实现是比较简单的!

       

css

#top {  
  
    position: absolute;  
    width: 0px;  
    height: 0px;  
    line-height: 0px;/*为了防止ie下出现题型*/  
    border-bottom: 10px solid #89b007;  
    border-left: 10px solid #fff;  
    border-right: 10px solid #fff;  
    left: 76px;  
    top: -10px;  
}  
#first {  
    border-radius:8px;  
    -moz-border-radius:8px;-ms-border-radius:8px;-o-border-radius:8px;-webkit-border-radius:8px;  
    position: absolute;  
    height: 150px;  
    width: 300px;  
    background: #89b007;  
    left: 22px;  
    top: 33px;  
}  
#first p{ padding:10px; line-height:1.5; color:#FFF;}

方法2:

html

  
    
    

用面向对象的思想去书写css,用面向对象的心态去书写css。

       ◆ ◆ 
  

css

* {  
margin: 0;  
padding: 0;  
}  
a{ color:#666; text-decoration:none; line-height:25px; text-indent:24px;}  
.w{ width:200px; position:absolute; background:#999; left:400px; top:200px; font-size:12px; text-align:left}/*模拟灰色阴影背景层*/  
.x{ width:180px; position:relative; background:#fff;  border:1px solid #ccc; padding:10px; left:-4px; top:-4px;}/*内容div*/  
.y , .z{  
position: absolute;  
left: 141px;  
}  
.y{  
color: #ccc;  
font-size: 19px;  
top:-12px;  
z-index:1;  
}/*模拟小三角*/  
.z{  
color: #fff;  
font-size: 19px;  
top:-11px;  z-index:3;  
}/*模拟小三角*/

方法3:

    
  

不管写什么内容,总之就是要实现无图小三角,要是有背景颜色那倒是极好的,没有的话也可以,就是稍微麻烦一点

  
#content {  
text-indent: 2em;  
box-shadow: 0px 0px 10px #999;  
padding: 10px;  
font-size: 12px;  
line-height: 1.5;  
border-radius: 5px;  
height: 100px;  
width: 250px;  
position: relative;  
margin: 200px auto;  
border: 1px solid #CCC;  
}  
span {  
position: absolute;  
left: 25px;  
height: 0px;  
width: 0px;  
}  
/*上部小三角实现样式开始*/  
span.out {  
line-height: 0;  
border-width: 10px;  
border-color: transparent transparent #CCC transparent;  
border-style: dashed dashed solid dashed;  
top: -20px;  
}  
span.iner {  
border-width: 10px;  
border-color: #fff transparent #FFF transparent;  
border-style: dashed dashed solid dashed;  
top: -19px;  
line-height: 0;  
}  
/*右部小三角实现样式开始*/  
span.right {  
background: #FFF;  
border-width: 1px;  
width: 16px;  
height: 16px;  
border-color: #CCC #CCC transparent transparent;  
border-style: solid solid dashed dashed;  
left: 270px;  
top: 30px;  
border-radius: 0 0 100% 0;/*这里radius的值不要选取绝对值因为在放大或者缩小的过程中会产生封不住口的现象*/  
line-height: 0;  
box-shadow: 5px 0 10px #aaa;  
}

感谢各位的阅读!关于“纯CSS怎么实现页面的尖角、小三角、不同方向尖角”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!


当前标题:纯CSS怎么实现页面的尖角、小三角、不同方向尖角
本文网址:http://cdkjz.cn/article/jgchgh.html
返回首页 了解更多建站资讯
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220