I have a blank div class that is called spacer ... it has a blue background and a width of 100% of the container (the body) ...
What I have found is that the spacer will not DISPLAY unless I toss some character in it. I can color the character blue so it is hidden, but that is so inelegant.
What is the CORRECT way to do this.
Just enter   ; inside your spacer div, but without the space before the semicolon. Alternatively, you could use break tags (<br>) to fill in the space, or a transparent spacer image set to the height you need.
Like :empty , :blank will select elements that contain nothing at all, or contain only an HTML comment. But, :blank will also select elements that include whitespace, which :empty will not. At the time of this writing, :blank is part of the CSS Selectors Level 4 draft, and is not supported by any browser.
A div (or any container element) is considered empty if it does not contain any other elements, text, or whitespace such as spaces or line breaks.
Give it a height.
Otherwise, with no content, it has zero height and is effectively invisible.
Add
inside to have some content inside the div
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With