DIV Width Match Content

E

ekazda

Okay, I know this can't be that hard... or can it? :stupido:

What I have are three elements within a custom CMS (I'm using some .net objects, but that doesn't matter in regards to what I am trying to do):

------

LABEL
DIV
FILE UPLOAD

------

I'm using the DIV to return information regarding any current image that may already exist on the server. If no image exists, I simply hide the DIV. If an image does exist, I display the DIV.

NOW, this DIV is style to have a nice border, some padding, and a pretty BG color. What I would like to do is SNAP THE WIDTH of the DIV to match the CONTENT (a hyperlink).

Using DISPLAY:INLINE snaps the width to the content PERFECTLY. However, it makes the layout change to the following:

------

LABEL DIV
FILE UPLOAD

------

That's no good.

Without DISPLAY:INLINE, the DIV stretches to match its container, which is 100%.

SO, the question is how do I maintain the BLOCK characteristics of the DIV, but simply snap the width to the content (WITHOUT JAVASCRIPT).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,821
Messages
2,569,725
Members
45,511
Latest member
Osiris-Team

Latest Threads

Top