當我使用1920x1080圖片(或其他分辨率我嘗試過)的以下內容時,圖片的頂部會被截斷。有什麼辦法可以防止這種情況發生?100%寬的背景圖像頂部截圖
div.background {
background-image: url("/images/home.jpg");
background-repeat: no-repeat;
position: absolute;
height: 100%;
width: 100%;
margin-top: 100px;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: 0;
background-position: 50% 50%;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
div.header {
background-color: red;
width:100%;
height: 100;
margin-top: 0px;
margin-right: 0px;
margin-left: 0px;
margin-bottom: 0px;
padding: 0px 0px 0px 0px;
}
body {
margin: 0px 0px 0px 0px;
}
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/main2.css">
</head>
<body>
<div class="header"></div>
<div class="background"></div>
</body>
</html>
這涵蓋標題 – cente