troubleshooting Question

Setting "shrink-to-fit" width on a non-floated element

Avatar of GlennGilbert
GlennGilbert asked on
CSS
20 Comments1 Solution439 ViewsLast Modified:
I need a non-floated box to have a variable width according to the content.  This is the behaviour for a floated box.

Ultimately this is to create a 'tab' style on a heading (setting the left and right background images).  


<p style="margin:0; border:1px solid black; padding:5px; background:yellow;">A full-width box</p>

<p style="float:left; clear:left; margin:0; border:1px solid black; padding:5px; background:yellow;">A shrink-to-fit box</p>


(e.g. section 10.3.3 of CSS2.1 spec)

Any ideas?
Glenn
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 20 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 20 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros