-1

The problem of the 3 columns not fully stretching on big screens

I'm trying to creat three Content containers with different % of screen width , but they won't stretch to cover the full screen width

CSS

 div 
               {
                   background-color: rgb(172, 168, 168);margin:2px;
            text-align: center;
                }
            .content-left,.content-right,.content-mid
               {
                float:left;text-align: center;
                }
            .content-mid {
                width: 50%;
            }
            .content-left,.content-right{width: 23%;}
            .container {
                width: 100%;
            }
            p {
               padding: 10px;
           }
          .footer {clear: both;}
<!DOCTYPE html>
<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1">
    
    </head>
    <body>
        
<div class="header"><p>Header</p></div>
<div class="Navbar"><p>Navigation Menu</p></div>

<div class="container">
<div class="content-left"><p>Content</p></div>
<div class="content-mid"><p>Main COntent</p></div>
<div class="content-right"><p>Content</p></div>
</div>

<div class="footer"><p>Footer</p></div>




    </body>
</html>

I tried using float:left , and tried using display:inline-block , same issue any idea ? the desired result is similar to what W3s have on their CSS /Layout section

1 Answers1

0

this is happening because you have 23% width to the right and left div and 50% to your center. If you add this values you'll see that you are missing a 4% to reach 100% and this is the reason that they don't cover the whole width. You'll have to add this 4% in one of your divs.

Thank you.

Alexander
  • 161
  • 8