Hey guys, I’m very new to CSS, so please excuse if my question is a bit elementary.
I’m busy with laying out a fictitious website, just for learning layout and positioning. What I want to do, is first lay out all my empty divs on the page, each one with a different colour, so I can clearly see what happens with the positioning.
Something like this:
The problem is, it seems I can’t give an empty div a background-color in my style sheet.
But it’s not working. Is is so that an empty div can’t have a background color? In previous layout exercises I’ve noticed that the parent div can’t have a background-color, but the divs inside it can.
But it’s not working. Is is so that an empty div can’t have a background color? In previous layout exercises I’ve noticed that the parent div can’t have a background-color, but the divs inside it can.
That’s correct, if there is nothing in the div then there is no height, hence no BG color.
What to do? What to do?
Just set min-height: on the divs to hold them open or go a head and place some test text in them.
Thanks for the markup. I understand it - fortunately - but as soon as I did it on my side, I ran into a problem.
I know setting the margin and padding to 0 in the body selector in my stylesheet takes away that thin gap at the top, which is a browser default, and I put it into my markup, but it’s not taking effect for some reason.