我在更大尺寸的顯示器上工作,當我在筆記本電腦上打開我的網(wǎng)站時,我立即意識到我的圖像沒有在我的 div 旁邊調整其自身大小,而是實際上將其自身放在了下面?我應該怎么辦??我已經(jīng)嘗試在網(wǎng)上尋找答案,但運氣不佳,該網(wǎng)站似乎或運行完美,基本上僅在我的顯示器上,但任何較小的東西,照片開始出現(xiàn)在文本下方。我對這一切都相當陌生,在鎖定期間學習新技能,所以不要對任何糟糕的代碼太用力,只是在努力解決這個問題 html, body { background-color: #fffaee; background-attachment: fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; font-family: 'Josefin Slab', serif; } #container { position: fixed; float: left; background: ; width: 424px; color: #000000; padding: 15px } h1 { font-size: 4vw } h2{ background: #75c1f6; color:black; padding: 5px; border-radius: 5px; } p{ font-size: 20px } a { color:#75c1f6; text-decoration: none; } footer { position: fixed; left: 0; bottom: 0; width: 100%; text-align: center; } #man { float: right; }
3 回答

largeQ
TA貢獻2039條經(jīng)驗 獲得超8個贊
將以下 css 設置為img和#container
img{
height : 100%;
width : 100%;
z-index : 1;
}
并為#container
#container{
height : 100%;
width : 100%;
position: fixed;
float: left;
background: ;
width: 424px;
color: #000000;
padding: 15px;
z-index : -1;
}
注意:z-index
屬性安排元素的堆棧順序。有關更多詳細信息,請參閱W3schools。
- 3 回答
- 0 關注
- 171 瀏覽
添加回答
舉報
0/150
提交
取消