width:auto question (This should be easy!)
In this page, I want the outer div (with the green border) to automatically be as small as the div within it. In this case, as small as the "hi". I have the inner div set to width:auto; margin:0 auto.
If I set the inner div to a width, then the outer div shrinks to that width. But at width:auto, the width goes to 100%.
This is the code:
This is the URL:
<div style="width:auto;margin:0 auto;border:10px solid green;">
I'd think that width:auto would tell the inner div to be only as wide as the content within it, but no. What's the workaround here? I can not set a width for this div.
(Sorry, I mistyped ... the green border is around the inner div. Regardless, what I want is for the border to just be around the little "hi" without having to set a width for the div.)
you could do the border on the element itself
you could use p or h* or whatever.
<span style="border:10px solid green;">
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread