position中的困惑,幫忙解決一下_html/css
來源:懂視網
責編:小采
時間:2020-11-27 16:39:39
position中的困惑,幫忙解決一下_html/css
position中的困惑,幫忙解決一下_html/css_WEB-ITnose: Document *{ margin:0; padding:0; } .parent{ background: red; position: absolute; left:60px; width: 300px; height: 300px; } .childRight{ background: blue; width: 240px; position: relative; right:60px; } .child-Right{ background: yellow; w
導讀position中的困惑,幫忙解決一下_html/css_WEB-ITnose: Document *{ margin:0; padding:0; } .parent{ background: red; position: absolute; left:60px; width: 300px; height: 300px; } .childRight{ background: blue; width: 240px; position: relative; right:60px; } .child-Right{ background: yellow; w

Document parent childRight child-Right childLeft child-Left hello
大家幫忙看一下,父標簽設置絕對定位,子標簽都設置了相對定位,兩個問題:1.為什么right:60px和left:-60px相同,第三個子標簽(.childLeft)為什么不顯示顏色了?
回復討論(解決方案)
對,
相對定位情況下,是以元素自身原本的位置進行偏移,右邊偏移正60px就等于左邊偏移負60px。
為什么不顯示顏色
childLeft
這么明顯,等于號你打成減號了
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
position中的困惑,幫忙解決一下_html/css
position中的困惑,幫忙解決一下_html/css_WEB-ITnose: Document *{ margin:0; padding:0; } .parent{ background: red; position: absolute; left:60px; width: 300px; height: 300px; } .childRight{ background: blue; width: 240px; position: relative; right:60px; } .child-Right{ background: yellow; w