Reputation: 367
I am new to css and can't figure out how to remove left and right paddings of the website heading in gray with "Website" in the center. In other words, I am trying to reduce the amount of gray area on the left and right side of the heading text. I tried to reduce the padding to 0px but it didn't do anything.
Upvotes: 0
Views: 68
Reputation: 1350
That's because the Website element is a block, it's 100% width by default. We can reduce the width of your choice and margin:auto to set it to the center.
.container {
width: 100vw;
height: 100vh;
}
h1 {
background-color: gray;
text-align: center;
color: white;
/**/
width: 200px;
margin: auto;
}
<div class="container">
<h1>Website</li>
</div>
Upvotes: 1