Jump to content

Expanding div...


rarebit

Recommended Posts

Hi,

I've awkwardly constructed a box (i'll try and optimise later). There's 3 images to make up a capsule box, two semi-circles at 13x25 and the centre's background at 2x25.

 

What i'm wanting to do is not to have to set the width of the inner div, but to let it resize automatically to the contents?

 

<html>
<head>
<style type="text/css">
.pagi_main {width:100%;height:25px;}
.pagi_left {background-image:url(cap_01_l.png);background-repeat:no-repeat;background-position:top left; width:13px;height:25px;position:absolute;}
.pagi_cen {background-image:url(cap_01_c.png);background-repeat:repeat-x;background-position:top left; left:13px;top:0px;width:auto;height:25px;position:absolute;padding:4px;}
.pagi_right {background-image:url(cap_01_r.png);background-repeat:no-repeat;background-position:top right; left:100%;top:0px;width:13px;height:25px;position:absolute;}
</style>
</head>
<body>
<br><br>
<div class='pagi_main'><div class='pagi_left'><div class='pagi_cen'>
1 2 3 4 5 6 7
<div class='pagi_right'></div></div></div></div>
<br><br>
</body>
</html>

 

Many thanks!

Link to comment
Share on other sites

No, that probably goes the other way. I still want it to size to the smallest width of the contents...

However, I have just wrapped the contents with a <nobr> tag, and in this instance, that'll do grand, ah!

Cheers...

 

Floating a div works just as well. I discourage using the <nobr> tag. Is there a css alternate, or could you floating the div to achieve the same look?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.