Margin-top and bottom not working
Hi guys, as you can see at the last page its right against the bottom of the previous div and against the top of the footer. If i try to add margin-top and bottom its not working. What am i doing wrong or where should i add this:
https://codepen.io/Boeroe/pen/qBgqwRZ
6 Replies
It's a classic issue, margin is working exactly as it's meant to which is just not intuitive. If you inspect the elements you'll see that the margin of the headings extends past the container. The margin will create spacing between other elements such as the services elements above it.
You want to add padding to the section, rather than using margin on the heading
And what padding can be used for the bottom of a section?
Padding: 3rem 3rem? So the first is for the top and second for the bottom?
Or is the 3rd for the bottom
3rem 0 3rem;
However much you want, but you can do
padding: 3rem 0
for top and bottom, none on the sides, you don't need the last 3rem
Perect, i deleted all the margin-top and bottom from the headers and added padding-top and bottom to all the containers/sections. Thats what u mean right?
All of the containers that need it, yes
Thank you so much