00 Votes

Only show DIV Box if it has content

Question by Guest | 2015-04-04 at 18:00

I am loading some images (products) into an HTML DIV box (container) dynamically. However, this box should only be shown, if there is actually data and content loaded.

At the moment, there is always an empty box displayed. How am I able to solve that?

ReplyPositiveNegative
1Best Answer1 Vote

Perhaps, the simplest solution is to not specify the height of the DIV (CSS: height: auto).

With this, the height of the DIV would automatically adapt to the content and if there should be no content in the box, the box will become so small that it remains invisible.
2015-04-06 at 23:36

ReplyPositive Negative
Reply

Related Topics

jQuery: Show and hide elements

Tutorial | 0 Comments

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.