我目前正在尝试制作登录页面,但遇到了问题。 <img>
周围有一些白色条纹,它looks like this .
我希望图片是全屏的,没有任何条纹等。
<!DOCTYPE HTML>
<head>
<title>Szafranowka - Apartments & Restaurant </title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="background">
<img src="background.jpg" id="background"> </img>
</div>
</div>
</body>
</html>
这是 CSS:
#container
{
width: 100%;
height: 100%;
}
#background
{
width: 100%;
height: auto;
opacity: 0.6;
position: relative;
}
最佳答案
内边距会自动应用于主体。
只需将其添加到您的 CSS
body{
padding:0;
margin:0;
}
编辑:在评论中跟进的解决方案
您需要删除 <img>
标记并更改 css 中的背景 div
#background
{
width: 100%;
height: auto;
background: url("background.jpg");
background-size: cover;
opacity: 0.6;
position: relative;
}
关于html - 去除全屏img中的白色条纹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48175250/