:after伪类+content经典应用举例
生活随笔
收集整理的這篇文章主要介紹了
:after伪类+content经典应用举例
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
:after偽類+content 清除浮動的影響
.box{padding:10px; background:gray;} .l{float:left;}<div class="box"><img class="l" src="http://image/imagemm1.jpg" /> </div>.fix:after{display:block; content:"clear"; height:0; clear:both; overflow:hidden; visibility:hidden;}:after偽類+content 讓大小不固定圖片垂直居中
.pic_box{width:300px; height:300px; background-color:#beceeb; font-size:0; *font-size:200px; text-align:center;} .pic_box img{vertical-align:middle;} .pic_box:after{display:inline-block; width:0; height:100%; content:"center"; vertical-align:middle; overflow:hidden;}<div class="pic_box"><img data-src="http://image/mm1.jpg" /> </div>轉載于:https://www.cnblogs.com/NatChen/p/7884124.html
總結
以上是生活随笔為你收集整理的:after伪类+content经典应用举例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: dataset 用法(1)
- 下一篇: 使用babel7 和 nodemon 进