html如何把上边角做成椭圆,使用css3的border-radius和border制作半圆、三角、椭圆等各种图形...

自从有了css3,我们可以制作各种各样的图形了,制作圆角也可以不使用图片了,我们可以使用border-radius可以制作圆角,椭圆等图形。下面我们来看一下如何制作这些的(以下例子请在现代高级浏览器浏览)。

css代码:

.content-wrap {

height:auto;

overflow:hidden;

}

.content-wrap h3 {

height:30px;

margin-top:40px;

}

.content-wrap ul {

width:100%;

height:auto;

overflow:hidden;

}

.content-wrap ul li {

float:left;

text-align:center;

margin:30px 100px 0 0;

list-style:none;

color:#fff;

line-height:50px;

padding:0

}

/*整圆*/

.content-wrap .circle {

width:100px;

height:100px;

border-radius:50px;

background:#306;

color:#fff;

text-align:center;

line-height:50px;

}

/*semi-circle半圆制作*/

.content-wrap .semi-circle li {

background:#000;

font-size:14px;

}

.content-wrap .semi-circle li:nth-child(1) {

width:50px;

height:100px;

border-radius:50px 0 0 50px

}

.content-wrap .semi-circle li:nth-child(2) {

width:100px;

height:50px;

border-radius:50px 50px 0 0

}

.content-wrap .semi-circle li:nth-child(3) {

width:50px;

height:100px;

border-radius:0 50px 50px 0

}

.content-wrap .semi-circle li:nth-child(4) {

width:100px;

height:50px;

border-radius:0 0 50px 50px

}

/*oval-shaped椭圆制作*/

.content-wrap .oval-shaped li {

background:#300

}

.content-wrap .oval-shaped li:nth-child(1) {

width:100px;

height:50px;

border-radius:50px / 25px;

}

.content-wrap .oval-shaped li:nth-child(2) {

width:50px;

height:100px;

border-radius:25px / 50px;

}

/*triangle三角形制作*/

.content-wrap .triangle li {

width:0;

height:0;

font-size:0;

line-height:0;

}

.content-wrap .triangle li:nth-child(1) {

border-left:20px solid transparent;

border-right:20px solid transparent;

border-bottom:20px solid #006;

}

.content-wrap .triangle li:nth-child(2) {

border-left:20px solid transparent;

border-right:20px solid transparent;

border-top:20px solid #006;

}

.content-wrap .triangle li:nth-child(3) {

border-top:20px solid transparent;

border-bottom:20px solid transparent;

border-right:20px solid #006;

}

.content-wrap .triangle li:nth-child(4) {

border-top:20px solid transparent;

border-bottom:20px solid transparent;

border-left:20px solid #006;

}

/**标签图形**/

#tag-shapes li {

padding: 0 20px;

height: 40px;

line-height: 40px;

text-align: center;

background: #2AADA2;

color: #fff;

position: relative;

margin:15px 0 50px 50px

}

#tag-shapes li:before {

content: '';

position: absolute;

left: -20px;

top: 0;

width: 0;

height: 0;

border-top: 20px solid transparent;

border-bottom: 20px solid transparent;

border-right: 20px solid #2AADA2;

}

#tag-shapes li:after {

content: '';

position: absolute;

left: 3px;

top: 14px;

width: 12px;

height: 12px;

background: #fff;

border-radius: 50%;

}

1、使用border-radius制作整圆

整圆

2、使用border-radius制作半圆

左半圆

上半圆

右半圆

下半圆

3、使用border-radius制作椭圆

椭圆1

椭圆2

3、使用border制作三角形

4、使用border制作标签图形效果

标签文字

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值