求教-該怎么弄?
那我該成#box1{ float:right; margin-bottom:30px; margin-right:10px;}就有反應(yīng)了。當我寫成
#box1{ float:right; margin-bottom:30px; margin-left:10px;}又沒有反應(yīng)了。我該成
#box1{ float:left; margin-bottom:30px; margin-left:10px;}有反應(yīng)了.我的問題就是:是不是當快級元素向左浮動,這時設(shè)置左邊界有反應(yīng),設(shè)置右邊界沒效果。當塊級元素向右浮動,這時設(shè)置右邊界有反應(yīng),設(shè)置左邊界沒效果?
如果我改成#box1{ margin-bottom:30px; margin-right:400px;}還是沒效果。此時父容器為650px,#box1為300px,則#box1到父容器的距離為350,我此時設(shè)置到像素點為400px。那么我的div距離父級容器邊框(350px)小于我設(shè)置的像素點了(400px),為什么還看不出來效果?
2015-01-16
#box1{ float:right; margin-bottom:30px; margin-left:10px;}你試著這樣理解,向右浮動,這時box1的margin-left可能已經(jīng)不止10px了,現(xiàn)在你又要求它向右,又要求它只離左邊10px,它要如何滿足你?
2015-01-16
關(guān)于right屬性無效的原因:right屬性只有在position是absolute的情況下才有效,而默認的position值是static,right屬性是無效的。建議能不使用right就不要使用right屬性。