This should be simplest thing ever but I couldn`t figure it out.
<div style="width:auto;background-color:#000000;color:#ffffff;">Example</div>
All I want is that background of this DIV should be big as much as the text in it. It`s like when I change “Example” to “Example of DIV” it should get bigger. I mean it should be big as much big as the text in it. How can I do it ?
Well, you could either add a
floatCSS property, or better,display: inline-blockor evendisplay: inline. This way the DIV will have a flexible width.