1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > html如何把上边角做成椭圆 使用css3的border-radius和border制作半圆 三角 椭圆等各种图形...

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

时间:2019-02-28 16:21:44

相关推荐

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制作标签图形效果

标签文字

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。