margin auto mistake

Website is sticking to the left, can't understand why. tried using
margin:auto
margin:auto
on body, didn't work live link :https://ahadweb3.github.io/Fitness-Landing-Page/ source: https://github.com/AhadWeb3/Fitness-Landing-Page
3 Replies
Joao
Joao2y ago
You have the following rule in place:
* {
margin: 0;
padding: 0;
max-width: 1440px; /* <----*/
list-style: none;
text-decoration: none;
font-family: 'Poppins', sans-serif;
border: 1px solid red;
}
* {
margin: 0;
padding: 0;
max-width: 1440px; /* <----*/
list-style: none;
text-decoration: none;
font-family: 'Poppins', sans-serif;
border: 1px solid red;
}
If you do want to enforce that limit and have the empty space on the sides, you have to apply the max-width on the body instead. I'm not quite sure why that is though, but it works. I think it's probably because it's applying to everything and that would affect the document itself?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Abdul Ahad⚡
Abdul Ahad⚡2y ago
done, thanks a lot