PDA

View Full Version : wish to have div width of its content and not 100%.



jasonc310771
Mar 8th, 2008, 12:59 PM
i wish to have the divs width the same as its content but also allow for adding padding to the left and right of the text or i could just add spaces to pad it which is one way i think is easier.

please advise what i need to change in my CSS.

thanks




.r1{ margin: 0 5px}
.r2{ margin: 0 3px}
.r3{ margin: 0 2px}
.r4{ margin: 0 1px; height: 1px }

.container { background:#325EAF; margin:0 5px; }
.rtop1, .rbottom1{ display:block; background:#507BCD; }
.rtop1 *, .rbottom1 *{ display: block; height: 1px; overflow: hidden; background:#325EAF; }




<div class="container" align="center"><b class="rtop1"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b><font color="#FFFFFF" size="2" face="Tahoma">Show ALL Members</font><b class="rbottom1"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b></b></div>

maxvee8
Mar 8th, 2008, 05:47 PM
why do you have all those classes.. surely you just need container and and the div for your menu?

how will the layout be... you may need to contain you menu "show all members" in a div will it be across the top or down the side,

jlhaslip
Mar 8th, 2008, 09:03 PM
why do you have all those classes.. surely you just need container and and the div for your menu?Rounded Corners using CSS is my guess.

jasonc310771
Mar 13th, 2008, 10:12 PM
the CSS is what i was given ages ago for getting rounded boxes for the text.

i have also used this for my hypertext links but have different colours for them.

i have created just a cut down version as an example for getting help in allow this link to show in the left side menu bar that contains many menu link downwards.

but all are shown with the bar at 100% and not relative to its content.

how can i do this so that the container is relative to its content?

thanks

_Aerospace_Eng_
Mar 13th, 2008, 11:14 PM
Two options, use float:left; or position:absolute; both have their drawbacks because they will disrupt the flow of the layout.

jasonc310771
Mar 27th, 2008, 02:01 AM
the code show a rounded content area at 100% of the table or div that it is in

i wish to have the area the same width as its content.