我需要做什麼(並且失敗)是這樣的網站:帶邊框的全屏幕背景圖片
網站需要全屏,沒有滾動。 我不太滿意的結果,因爲:
- 當網頁被打開的垂直簾(智能手機)在底邊框太大
-I也試圖讓這個背景圖像顯示完全頂底部(我想面對頂部和底部全面看,而不僅僅是部分),但我真的不知道該怎麼做。
我的CSS代碼:
body {
background: url('http://web-industry.eu/landing/img/bg.png') no-repeat;
background-size: 100% 100%;
width: 100vw;
height: 100vh;
box-sizing: border-box;
border: #f36d32 3px solid;
padding: 0;
margin: 0;
}
<body></body>
:
html
{
background: #f36d32;
width: 98%;
height: 95.9%;
padding: 1%;
}
body
{
background: url(http://web-industry.eu/landing/img/bg.png) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
width: 100%;
height: 100%;
}
好,邊界問題是由@imGaurav用這樣的代碼來解決但我仍然無法弄清楚如何使頂面和底面都可見。
你能分享你的代碼嗎? –
請發佈您的jsfiddle。 – Alex
對不起,這裏是我的代碼:https://jsfiddle.net/24rcLmsj/ – engray