...

View Full Version : How to make a fluid width for a div?



cixxy
06-09-2010, 08:34 AM
I need a fluid width for my comments.

On the site, you can see their width on the divs need to change to look properly.

Anyone know how to achieve this ? I tried using % with widths, it worked but the % needs to change dynamically cause sometimes it goes over to the next line like it does now.

http://anothera.net/v2/tutorials/photoshop-tutorials/sin-city-w-a-twist

http://i48.tinypic.com/72g3dd.jpg

craftygeek
06-09-2010, 09:28 AM
I'm not completely sure what the problem is, but if the width is left blank or auto, just using margins should contain it in the space that you have - if the width needs to be fluid, which its not at the moment, then the div containing all the comments can scale, the comments inside would stretch to fit automatically.

cixxy
06-09-2010, 09:52 AM
I'm not completely sure what the problem is, but if the width is left blank or auto, just using margins should contain it in the space that you have - if the width needs to be fluid, which its not at the moment, then the div containing all the comments can scale, the comments inside would stretch to fit automatically.

1. the left part of the column of divs is a fixed width

2. the right part is left blank /auto. I'm trying to get it not stretch 100% to the next line but contain it in the 2nd column to no avail. This is because I can't use a fixed width since the integer changes with every comment

3. I have one margin in there defined. you suggest more?

Scriptet
06-09-2010, 08:55 PM
You need to remove float:left; from your wpcommentright..

If you want the text to flow underneath the avatar then keep it as it is, or if you want it to keep the gap then you need to add margin-left:130px; to wpcommentright also.

cixxy
06-10-2010, 02:29 AM
Thanks!! Also adding a position:relative; fixed everything

Scriptet
06-11-2010, 01:10 AM
position:relative; wouldn't really change anything here but glad you got it working anyway. Basically if you want one of the columns to be of fluid width then you can't specify float:left; otherwise it won't sit next to the other float (because it will eventually go to 100% width rather than taking up the remaining space), then if desired you can add a left/right-margin so that it doesn't wrap around the float next to it.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum