清除浮动
.wrapper::after{
content: ‘’;
clear: both;
display: block;
}
/* clear生效必须是块级元素 */
position:absolute;
float:left/right;
在内部将元素转换为inline-block
伪元素
伪元素默认是inline行级元素
span::before{
position: absolute;
left: 0;
top: 100px;
content:‘内容’;
display: inline-block;
width: 100px;
height: 100px;
background-color: red;
}
span::after{
content: ‘内容’;
}
/* 文字环绕图片
浮动即可
*/
.img1{
margin-left: 10px;
float: left;
width: 100px;
}