Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why is footer not taking 100% width?

I have this simple React app and my footer does not take 100% width (I see small white space on the left and right sides). Can anyone tell me what I’m missing, please?

Here’s LIVE DEMO

Here’s my css:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

.App {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.footer {
  margin-top: auto;
  background-color: #000;
  color: #fff;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  padding: 25px 0;
}



App.tsx

  return (
     <div className="App">
       <Footer />
     </div>
    );


Images of my issue:

enter image description here

>Solution :

The body element has a default 8px margin, have you removed it? If not, you can simply add to you .css file the following code:

body {
  margin: 0px;
}

Hope it helps you, if this is not your case feel free to comment here with more details.
Update: I tried adding it to your codesandbox and it worked here for me.
enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading