<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