HollerTrain HollerTrain - 1 year ago 176
CSS Question

Div Size Automatically size of content

I am trying to make a h2 header for sidebar widgets but I want the width of the div class to be whatever width the content becomes. It seems I can't just set a width because those headlines with longer content then shorter content makes it break.

How can I simply make width stretch/change depending on the length of content there is? Any help would be greatly appreciated.

Answer Source

As far as I know, display: inline-block is what you probably need. That will make it seem like it's sort of inline but still allow you to use things like margins and such.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download