一、设置边框弧度
border-radius: 30px;
二、通过边框设置三角形
注意:1.元素宽高设置为0
2.通过透明色要设置
width: 0;
height: 0;
border: 20px solid red;
border-color: red yellowgreen blue gold;
border-color: transparent transparent blue transparent;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
div.cir {
width: 200px;
height: 200px;
background-color: pink;
border-radius: 100px;
}
div.half {
width: 200px;
height: 100px;
background-color: aqua;
border-radius: 100px 100px 0 0;
}
div.half2 {
width: 200px;
height: 100px;
background-color: black;
border-radius: 0 0 100px 100px;
}
div.half3 {
width: 100px;
height: 200px;
background-color: rgb(119, 210, 27);
border-radius: 100px 0 0 100px ;
}
div.half4 {
width: 100px;
height: 200px;
background-color: rgb(82, 126, 237);
border-radius: 0 100px 100px 0;
}
div.halfhalf {
width: 100px;
height: 100px;
background-color: blueviolet;
border-radius: 100px 0 0 0;
}
div.halfhalf2 {
width: 100px;
height: 100px;
background-color: brown;
border-radius: 0 100px 0 0;
}
div.halfhalf3 {
width: 100px;
height: 100px;
background-color: coral;
border-radius: 0 0 100px 0;
}
div.halfhalf4{
width: 100px;
height: 100px;
background-color: chartreuse;
border-radius: 0 0 0 100px;
}
.san1 {
/* width: 100px; */
/* height: 100px; */
width: 0;
height: 0;
/* background-color: greenyellow ; */
border: 100px solid;
border-color: greenyellow transparent transparent transparent;
}
.san2 {
width: 0;
height: 0;
border: 100px solid;
border-color: transparent black transparent transparent;
}
.san3 {
width: 0;
height: 0;
border: 100px solid;
border-color: transparent transparent blue transparent;
}
.san4 {
width: 0;
height: 0;
border: 100px solid;
border-color: transparent transparent transparent gold;
}
</style>
</head>
<body>
<div class="cir"> </div>
<div class="half"></div>
<br>
<div class="half2"></div>
<div class="half3"></div>
<div class="half4"></div>
<div class="halfhalf"></div>
<div class="halfhalf2"></div>
<br>
<div class="halfhalf3"></div>
<br>
<div class="halfhalf4"></div>
<div class="san1"></div>
<div class="san2"></div>
<div class="san3"></div>
<div class="san4"></div>
</body>
</html>
三、显示与隐藏
display:
可选值:none(影藏)block(显示)
visibility:
可选值:hidden(元素不可见)visible(元素可见)
区别是display设置隐藏时,不占用原来的位置
visibility设置元素不可见时,依旧占有原来的位置
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
width: 200px;
}
div{
background-color: aqua;
}
p{
background-color: blueviolet;
display: none;
/* visibility: hidden; */
}
div:hover>p{
display: block;
/* visibility: visible; */
}
</style>
</head>
<body>
<div>
开应杨不丑。
<p>要失同命若。</p>
<h3>一若国</h3>
</div>
</body>
</html>