# 圆与椭圆
通常我们一般使用border-radius
来时实现圆角效果,其实border-radius
是可以单独指定它的半长轴和半短轴,只需要用“/”分割即可。我们可以通过这个属性轻松实现半圆、半椭圆、四分之一圆及四分之一圆等常见的图形。
<style scoped>
.main {
width: 100%;
padding: 60px 0;
display: flex;
flex-wrap: wrap;
justify-content: space-around;
}
.ellipse {
width: 200px; height: 150px;
background: #b4a078;
margin-bottom: 30px;
}
.ellipse:nth-of-type(1) {
width: 300px; height: 150px;
border-radius: 50% / 100% 100% 0 0;
}
.ellipse:nth-of-type(2) {
width: 150px; height: 150px;
border-radius: 100% 0 0 0;
}
.ellipse:nth-of-type(3) {
border-radius: 50% / 100% 100% 0 0;
}
.ellipse:nth-of-type(4) {
width: 100px;
border-radius: 100% 0 0 0;
}
.ellipse:nth-of-type(5) {
width: 300px;
border-radius: 50% / 0 100%;
}
.ellipse:nth-of-type(6) {
width: 300px;
border-radius: 50% / 100% 0;
}
</style>
<template>
<div class="main">
<div class="ellipse"></div>
<div class="ellipse"></div>
<div class="ellipse"></div>
<div class="ellipse"></div>
<div class="ellipse"></div>
<div class="ellipse"></div>
</div>
</template>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
← 经典图表 parallel四边形 →