Background-color isn't covering 100% width of the page

Hi,
I’m currently stuck at figuring out how to cut white places on left and right side of my divs. I tried max-width, width, left: 0, but still doesn’t working. If it helps, my html and body background-color are covering 100% width of the page.
Here is example of one of my div (HTML code):

<div class="fourth_div">
    <h1>Milujem tradíciu Čaj o Piatej a Access Bars</h1>
    <p>Pozývam Ťa do fb skupiny Access Čajovňa, kde zdieľam každodennosť s Access Bars®</p>
    <div id="fourth_blue_button_wrap">
        <p>Vstup do fb skupiny</p>
    </div>
</div>

My CSS code for .fourth_div:

.fourth_div {
    text-align: center;
    background-color: orange;
}

#fourth_blue_button_wrap {
    display: flex;
    justify-content: center;
}

#fourth_blue_button_wrap p {
    background-color: blue;
    padding: 1rem;
    border-radius: 15px;  
    font-size: 27.5px;
    font-weight: 500;
    color: white;
}

I would appreciate any help.

It would be nice with some more context or an example on Codepen but my first guess would be it’s the default margin on the body that you haven’t removed.

body {
  margin: 0;
}
1 Like

I’m currently working with Visual Studio Code and I wasn’t sure how to share my code. I didn’t want to share the whole code, because I thought it would be useless. Anyway, I did try margin: 0; for everything (html,divs etc.), but eventually not for body :d The problem was asinine and I hate it, but thankfully because of you now it’s working!

Thank you,
Cheers

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.