原理
父級(jí)元素 relative,子元素 absolute,然后通過top、left、right、bottom來設(shè)置具體出現(xiàn)位置。
DOM結(jié)構(gòu)
| <div class="wrapper-dashed"> <div class="dashed"></div></div> | 

CSS樣式
| .wrapper-dashed{ position: relative; height: 1px; width: 100%;}/*虛線實(shí)現(xiàn)*/.dashed { border-top: 1px dashed #cccccc; height: 1px; overflow: hidden;}.dashed:before, .dashed:after{ display: block; position: absolute; content: ""; width:10px; height:10px; background-color:#f3f5f9; border-radius:50%; top: -5px;}.dashed:before{ left: -5px;}.dashed:after{ right: -5px;} | 
效果圖


以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持錯(cuò)新站長站。
新聞熱點(diǎn)
疑難解答
圖片精選