為什么圓點不加float:left就顯示不出來,加了float:left就可以正常顯示?
<!DOCTYPE?html> <html> ?<head> ??<meta?charset="utf-8"> ??<title></title> ??<style?type="text/css"> ???.btn?{position:?absolute;height:?10px;width:?100px;top:?20px;left:?250px;} ????.btn?span{float:right;cursor:pointer;border:?1px?solid?#fff;width:?10px;height:?10px;border-radius:?10px;background:?#333;margin-right:?5px;} ????</style> ?</head> ?<body> ??<div?class="btn"> ??<span> ??</span> ??</div> ????</body> </html>
2016-10-12
span是內(nèi)聯(lián)元素,寬度高度設(shè)置無效;而且在<span></span>,沒有內(nèi)容情況下當(dāng)然不顯示。
float不緊可以左浮動使其在一行顯示,而且會轉(zhuǎn)化為塊級元素使得寬高設(shè)置生效
大致這個意思,可以看一下http://idcbgp.cn/learn/121 張鑫旭關(guān)于浮動的深入講解 5-3 float與display:block化,