CSS 日常练习----堆叠上下文练习

记录日常 CSS 练习的小知识点 —— 堆叠上下文练习

堆叠上下文练习

点击预览

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
48
49
50
51
52
53
54
55
56
57
58
59
60
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>圆角</title>
<style>
div.test{
width: 300px;
height: 300px;
border-width:20px 40px;
border-color: red;
border-style: solid;
margin: 20px auto;
border-top-left-radius: 100px;
}
.test1{
width: 300px;
height: 300px;
border-width:20px 40px;
border-color: red;
border-style: solid;
margin: 20px auto;
border-top-left-radius: 40px;
}
.test2{
width: 300px;
height: 200px;
border:20px red solid;
margin: 20px auto;
/*border-radius: 150px 0 0 150px/150px 0 0 150px;*/
border-radius: 150px 0 0 150px;
/*border-radius: 50% 0 0 50%/50% 0 0 50%;*/
}
.test3{
width: 300px;
height: 200px;
border:20px red solid;
margin: 20px auto;
/*border-radius: 50% 50% 0 0/100% 100% 0 0;*/
/*简化:*/
border-radius: 50%/100% 100% 0 0;
}
div.test4{
width: 300px;
height: 200px;
border:20px red solid;
margin: 20px auto;
border-radius: 100% 0 0 0;
}
</style>
</head>
<body>
<div class="test">边框和内外径</div>
<div class="test1">边框和内外径</div>
<div class="test2">椭圆:</div>
<div class="test3">半椭圆</div>
<div class="test4">四分之一椭圆</div>

</body>
</html>
0%