我試圖將這個不和諧小部件移動到左角,但由于某種原因,我不能。我對網絡開發還很陌生,這是我第一次嘗試響應式網站,所以很抱歉我犯了一些愚蠢的錯誤xd我嘗試過調整位置類型和顯示以及所有這些,但并沒有真正找到什么錯誤的。CSS:body{ background-image: url("background.jpg"); background-size: cover; background-attachment: fixed;}/* contact */.contact{ position: relative; bottom: 80px; left: 15px; padding: 0; margin: 10 5 50 auto; box-shadow: 0 0 10px rgba(0, 0, 0, 1); border-radius: 5px;}/* tablet */@media only screen and (min-width: 768px) { .profile{ position: relative; width: 100%; left: 10%; } .about__me{ position: relative; width: 100%; left: 10%; } .contact{ position: relative; width: 100%; left: 40%; } .somw{ position: relative; width: 125%; } .somw__content{ position: relative; width: 95%; left: 5%; }}/* Desktop */@media screen and (min-width: 1000px) { /*profile picture ----------------------------------------------*/ .profile{ position: static; width: 700px; height: 200px; right: 100%; } .about__me{ position: relative; width: 700px; left: 541px; bottom: 90px; } .contact{ position: relative; width: 20.4%; height: 280px; right: 200px; } .somw{ width: 10%; }}
1 回答

慕萊塢森
TA貢獻1810條經驗 獲得超4個贊
.contact{ position: relative; width: 20.4%; height: 280px; right: 200px; }
這段代碼幾乎就是css的最后一段了。這將包含小部件的 div 設置為 20% 寬,距右側 200px。
您試圖覆蓋上面的它,但 css 按順序渲染,最后一條規則覆蓋了前一條規則。
您還在媒體查詢之外進行覆蓋,媒體查詢被寫入以更改某些屏幕尺寸的布局,并且它是“響應式”的,因此您的樣式需要進入桌面的最后一個媒體查詢
- 1 回答
- 0 關注
- 137 瀏覽
添加回答
舉報
0/150
提交
取消