Issue with image not covering 100% of page width

Tell us what’s happening:
I want to make my image to cover 100% of the page width but there are white spaces on the left and right and I don’t know how to eliminate them.

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/responsive-web-design/responsive-web-design-projects/build-a-personal-portfolio-webpage

I’ve done it.
I had to put in my CSS what follows:

body, html {
width: 100%;
margin-left: 0;
}

2 Likes

Bonjour il suffit, je pense d’initialiser votre page avec un margin et un padding à 0 et cela devrai enlever les marges par défaut. comme ceci:
Hello enough, I think to initialize your page with a margin and a padding to 0 and this will have to remove the margins by default. like this:
*{
margin: 0;
padding: 0;
}

A useful tip I started doing that a lot of developers put before starting all the CSS is to reset all the default margin and padding on the page so you can start on a clean slate.

The code usually consists of an asterisk selector, which selects all the elements:

  • {
    margin: 0;
    padding: 0;
    }

Hope this helps!
J

Thanks a lot. I’ve heard about it in one of my lectures from Udemy. But there instructor said he doesn’t recommend it for some reason I don’t recall.
I got around the problem making
body, html {
width: 100%;
margin-left: 0;
}
But thanks again for the advice. I will ask the instructor what’s his opinion again on your solution.
Best regards