DAY3

1-在一个页面中给多个元素设置同样的 id,会导致什么问题?
获取的是对象,则获取无法获取到多个同样id的元素,只能得到一个
2-用伪类实现一个上三角(代码)

.sj {
width: 100px;
height: 50px;
background-color: blueviolet;
border-radius: 5px;
position: relative;
}

.sj:before {
content: "";
width: 0px;
height: 0px;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 10px solid #be3f3f;
position: absolute;
top: -10px;
left: 78px;
}
</style>
</head>

<body>
<div class="sj"></div>
</body>

</html>

3-怎么让一个不定宽度的 div 实现垂直和水平居中(三种方法 代码)?
使用定位  flex 
4-清浮动的方式有哪些?
clear:both
overflow:hidden
5-如何让两个块级元素显示在同一行
float: left
posted @ 2021-01-31 18:10  王颜桑  阅读(46)  评论(0)    收藏  举报