<link rel="stylesheet" href="./a.css">
给全部的子元素加上float:left;
给子元素的爸爸添加上名为clearfix的类;css
.clearfix::after{
content: '';
display: block;
clear: both;
}
复制代码
text-decoration: none
display: block
color: inherit;
padding: 20px 16px 20px 16px;
border:1px solid red;
word-break:break-all;
能够将其打断;display:inline-block;
尽可能不用这个,用float;position: fixed;
脱离文档流;相对于屏幕;少用width:100%;
max-width: 940px;
最大宽度能够自适应;margin-left: auto; margin-right: auto;
即可自动居中;display:block
就是div;position: absolute;
相对于祖先中的第一个position: relative;
定位;display:inline;
须要后续学习;.yin-yang {
width: 192px;
box-sizing: content-box;
height: 96px;
background: #eee;
border-color: red;
border-style: solid;
border-width: 4px 4px 100px 4px;
border-radius: 100%;
position: relative;
}
.yin-yang:before {
content: "";
position: absolute;
top: 50%;
left: 0;
background: #eee;
border: 36px solid red;
border-radius: 100%;
width: 24px;
height: 24px;
box-sizing: content-box;
}
.yin-yang:after {
content: "";
position: absolute;
top: 50%;
left: 50%;
background: red;
border: 36px solid #eee;
border-radius: 100%;
width: 24px;
height: 24px;
box-sizing: content-box;
}
复制代码
效果图:
bash