: CSS spaces, top element or bottom element? Whenever I format a website according to a PSD file, I always wonder if the space should be from the top element or the bottom one. So if I
Whenever I format a website according to a PSD file,
I always wonder if the space should be from the top element or the bottom one.
So if I have 2 elements that are seperated by some space, I normally choose
the top one, but I can't find a real reason not to choose the one on the bottom.
Any ideas?
More posts by @Samaraweera270
2 Comments
Sorted by latest first Latest Oldest Best
If it's always the same two elements as siblings (for example, a header div followed by a menu div at the top of each page), then there is no difference between adding margin-bottom (or padding) to the top vs. adding margin-top to the bottom.
OTOH, if the elements in question sometimes appear elsewhere in the document (for example, an H2 can be an article title followed by a byline in one place or a subheading followed by a paragraph elsewhere), then the answer will depend on how you need them to behave in each of the places.
I would typically add it to the upper element as padding-bottom:10px (or whatever whitespace size you need.
I find that I typically want "any content after this" to be a certain distance away. very rarely do I find the reverse ideal. (although its an easy modification if needed)
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.