Day3
1-在一个页面中给多个元素设置同样的 id,会导致什么问题?
css样式混乱
2-用伪类实现一个上三角(代码)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.triangle:after{
content: "";
position: absolute;
left: 200px;
top:12px;
width: 0;
height: 0;
border-top: 100px solid transparent;
border-left: 100px solid transparent;
border-right: 100px solid transparent;
border-bottom: 100px solid chartreuse;
}
</style>
</head>
<body>
<div class="triangle"></div>
</body>
</html>
3-怎么让一个不定宽度的 div 实现垂直和水平居中(三种方法 代码)?
1.
display:flex;
content:center;
align-item:center;
2.
transform: translate( -50%, -50%);
position:absolute;
top:50%;
left:50%;
3.
display:table-cell;
text-align:center;
vertical-align:middle;
display:inline-block;
vertical-align:middle;
4-清浮动的方式有哪些?
clear: both;
5-如何让两个块级元素显示在同一行
.one,.two{
width: 50%;
height: 300px;
border:1px solid #ccc;
float: left;
box-sizing: border-box;
}