目前正在网站上工作,而且我一直在努力应对背景图片。我认为它可能是由侧边栏引起的(我创建的第一个网站有侧边栏)。 而现在由于一些奇怪的原因,它周围有一个白色边框。
这是图像https://gyazo.com/d81f071f3e0d5b18020485565271557b
@font-face {
font-family: 'source_sans_prolight';
src: url(font1/sourcesanspro-light-webfont.woff2) format("woff2"), url(font1/sourcesanspro-light-webfont.woff) format("woff");
font-weight: 400;
font-style: normal;
}
@font-face {
font-family: 'open_sansregular';
src: url(font2/opensans-regular-webfont.woff2) format("woff2"), url(font2/opensans-regular-webfont.woff) format("woff");
font-weight: 400;
font-style: normal;
}
@font-face {
font-family: 'edoregular';
src: url(font3/edo-webfont.woff2) format("woff2"), url(font3/edo-webfont.woff) format("woff");
font-weight: 400;
font-style: normal;
}
.sidebar {
width: 200px;
height: 100%;
background-color: #212121;
top: 0;
left: 0;
position: fixed;
-webkit-box-shadow: 4px 0px 35px 2px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 4px 0px 35px 2px rgba(0, 0, 0, 0.75);
box-shadow: 4px 0px 35px 2px rgba(0, 0, 0, 0.75);
}
.logo {
width: 180px;
padding: 30px 10px 50px;
border-bottom: 1px solid #2A2A2A;
}
.menu ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.menu li a {
display: block;
padding: 10px 0;
border-bottom: 1px solid #2A2A2A;
color: #fff;
text-decoration: none;
text-align: center;
font-family: source_sans_prolight;
font-size: 17px;
transition: opacity .15s ease-in-out;
-moz-transition: background-color .15s ease-in-out;
-webkit-transition: background-color .15s ease-in-out;
}
.menu li a:hover {
background-color: #fff;
color: #000;
}
.midheader {
margin: 0 auto;
width: 180px;
height: 25px;
padding-top: 30px;
}
.midheader h1 {
font-family: edoregular;
}
.midheader p {
font-family: open_sansregular;
font-size: 13px;
text-align: justify;
color: #fff;
}
.button1 {
background-color: #3AC6F4;
border: none;
color: #fff;
width: 180px;
height: 50px;
font-family: edoregular;
font-size: 20px;
-webkit-box-shadow: 0 3px 5px -2px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 0 3px 5px -2px rgba(0, 0, 0, 0.75);
box-shadow: 0 3px 5px -2px rgba(0, 0, 0, 0.75);
-moz-transition: background-color .15s ease-in-out;
-webkit-transition: background-color .15s ease-in-out;
}
.button1:hover {
background-color: #fff;
color: #000;
}
.content1 {
background-image: url(images/firstimgbk.svg);
height: 1080px;
outline: none;
}
.title {
margin: 0 auto;
width: 850px;
padding-left: 200px;
font-family: edoregular;
font-size: 100px;
padding-top: 180px;
text-align: center;
color: white;
text-shadow: 2px 5px #292929;
}
.title p {
font-size: 40px;
text-shadow: 5px 2px #292929;
}
.arrow {
left: 50%;
bottom: 10px;
position: absolute;
width: 100px;
padding-left: 50px;
-moz-transition: -webkit-filter .15s ease-in-out;
-webkit-transition: -webkit-filter .15s ease-in-out;
}
.arrow:hover {
-webkit-filter: drop-shadow(0px 2px 2px black);
}
.content2 {
height: 1080px;
background-color: white;
}
.footer {
margin: 0 auto;
position: fixed;
bottom: 20px;
padding: 20px;
height: 20px;
font-family: open_sansregular;
font-size: 13px;
color: #fff;
border-top: 1px solid #2A2A2A:
}

<!DOCTYPE html>
<html>
<head>
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<link href="css/style.css" rel="stylesheet">
<link href="css/images/favicon.ico" rel="shortcut icon">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Loom | Home</title>
</head>
<body>
<a id="home" name="home"></a>
<div class="sidebar">
<div class="logo">
<a href="index.html">
<img alt="Logo" src="css/images/exloomd&c.svg">
</a>
</div>
<div class="menu">
<ul>
<li>
<a href="#home">Home</a>
</li>
<li>
<a href="index.html">About</a>
</li>
<li>
<a href="index.html">Portfolio</a>
</li>
<li>
<a href="index.html">Contact</a>
</li>
</ul>
</div>
<div class="midheader">
<p>Check out my new website where our goal is to provide the cheapest most requested products!</p>
<button class="button1">ExLoom Market
</button>
</div>
<div class="footer">
<div class="footer">
©2016 ExLoom.
<br>All Rights Reserved.
</div>
</div>
</div>
<div class="content1">
<div class="title">
hello
<p>hello</p>
</div>
<div class="arrow">
<img src="css/images/arrowdown.svg">
</div>
</div>
<div class="content2">
hej
</div>
</body>
</html>
&#13;
答案 0 :(得分:3)
默认情况下,大多数浏览器都会为<body>
元素提供边距。将其删除:
body {
margin: 0;
}