I am trying to make a hero image with no white spaces on the sides. For some reason I am still getting them even after inspecting the element and finding out that it was my body’s margin, and setting that to 0
.body {
font-family: 'Times New Roman', Times, serif;
margin: 0;
padding: 0;
}
.navigation {
margin: 0;
overflow: hidden;
width: 100vw;
display: flex;
align-items: center;
justify-content: center;
padding-bottom: 15px;
}
a {
text-decoration: none;
font-weight: light;
}
.navigation-inner {
background: #eaeae4;
border-radius: 5px;
overflow: hidden;
}
.navigation-inner {
font-size: 28px;
display: flex;
}
.notification-round {
background: rgba(240,0,0,.6);
color: white;
padding: 0 8px;
border-radius: 50%;
font-size: 16px;
margin-left: 3px;
}
.navigation-link {
padding: 15px 20px 10px 20px;
display: inline-block;
color: rgba(0,0,0,.7);
transition: all .2s ease-in-out;
border-bottom: 4px solid transparent;
}
.navigation-link:hover {
background: rgba(50,50,0,.1);
border-bottom-color: #8acc84;
}
.navigation-link > i {
padding-right: 8px;
}
/*HERO*/
#home {
background-size:
}
.hero-image {
background-image: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.1)), url("../images/furniture.jpg");
height: 400px;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
}
.hero-text {
text-align: center;
position: absolute;
top: 25%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
}
.hero-text h1 {
font-size: 50px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bill's Furniture Emporium</title>
<link rel="stylesheet" href="./css/one_page_website.css">
</head>
<body>
<!-- NAV -->
<div class = "navigation">
<header class="navigation-shadow">
<div class = "navigation-inner">
<a href="#home" class="navigation-link" id="link">HOME</a>
<a href="#gallery" class="navigation-link" >GALLERY</a>
<a href="#contact" class="navigation-link" >CONTACT</a>
</div>
</header>
</div>
<!--HOMEPAGE-->
<div id="home">
<div class="hero-image">
<div class="hero-text">
<h1>Bill's Furniture Emporium</h1>
</div>
</div>
</div>
</body>
</html>
I tried inspecting the element and removing the margin and padding yet it didn’t work
2
Answers
You should set the root also, try to add this:
Read more here.
The issue is that you are using a class selector in your css:
when you should be using an element selector:
Remove the dot from your css and it should work.