HighDots Forums  

Widths: Fixed vs percentage

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Widths: Fixed vs percentage in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mark Smith
 
Posts: n/a

Default Widths: Fixed vs percentage - 01-14-2009 , 07:18 AM






I have a table like the following, with a cell that I need to be a
fixed width/height to accommodate its background image.

I want the other cell to take up all of the *remaining* width. However
width:100% seems to use all the width before allocating space for the
fixed width cell.

Is there a way to specify a percentage of the remaining width after
all the fixed width cells have been drawn?

(I know in this simple example it's easier just to say width:84px for
the second cell, but in real life I won't always know the exact width
of the container)

Thanks for any ideas.

<table style="width:100px">
<tr style="height:20px;">
<td style="width:16px;background-color:red"></td>
<td style="width:100%;background-color:green"></td>
</tr>
</table>

Reply With Quote
  #2  
Old   
Chris F.A. Johnson
 
Posts: n/a

Default Re: Widths: Fixed vs percentage - 01-14-2009 , 07:36 AM






On 2009-01-14, Mark Smith wrote:
Quote:
I have a table like the following, with a cell that I need to be a
fixed width/height to accommodate its background image.

I want the other cell to take up all of the *remaining* width. However
width:100% seems to use all the width before allocating space for the
fixed width cell.

Is there a way to specify a percentage of the remaining width after
all the fixed width cells have been drawn?

(I know in this simple example it's easier just to say width:84px for
the second cell, but in real life I won't always know the exact width
of the container)

Thanks for any ideas.

table style="width:100px"
tr style="height:20px;"
td style="width:16px;background-color:red"></td
td style="width:100%;background-color:green"></td
/tr
/table
<table style="width:100%">
<tr style="height:20px;">
<td style="width:16px;background-color:red"></td>
<td style="background-color:green"></td>
</tr>
</table>

Note, however, that 20px may not be high enough to contain any
text.

--
Chris F.A. Johnson <http://cfaj.freeshell.org>
================================================== =================
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)


Reply With Quote
  #3  
Old   
Mark Smith
 
Posts: n/a

Default Re: Widths: Fixed vs percentage - 01-14-2009 , 08:57 AM



On Jan 14, 12:36*pm, "Chris F.A. Johnson" <cfajohn... (AT) gmail (DOT) com>
wrote:
Quote:
On 2009-01-14, Mark Smith wrote:



I have a table like the following, with a cell that I need to be a
fixed width/height to accommodate its background image.

I want the other cell to take up all of the *remaining* width. However
width:100% seems to use all the width before allocating space for the
fixed width cell.

Is there a way to specify a percentage of the remaining width after
all the fixed width cells have been drawn?

(I know in this simple example it's easier just to say width:84px for
the second cell, but in real life I won't always know the exact width
of the container)

Thanks for any ideas.

table style="width:100px"
tr style="height:20px;"
td style="width:16px;background-color:red"></td
td style="width:100%;background-color:green"></td
/tr
/table

table style="width:100%"
* <tr style="height:20px;"
* * <td style="width:16px;background-color:red"></td
* * <td style="background-color:green"></td
* </tr
/table

* *Note, however, that 20px may not be high enough to contain any
* *text.

--
* *Chris F.A. Johnson * * * * * * * * * * *<http://cfaj.freeshell.org
* *================================================= ==================
* *Author:
* *Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
Thanks, looks good now.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.