SyntaxFix
Write A Post
Hire A Developer
Questions
You could just set the width to auto. Then the width of the div will equal 0 if it has no content.
width:auto;