Combining fixed and relative widths

This is a discussion on "Combining fixed and relative widths" within the Web Page Design section. This forum, and the thread "Combining fixed and relative widths are both part of the Design Your Website category.



 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1  
Old Feb 9th, 2006, 16:00
Junior Member
Join Date: Aug 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Combining fixed and relative widths

I'm sure this is very easy but I can't think how to do it.
How do I position something with a fixed width (eg a picture) on the page, and put something next to it (eg text) and tell it to fill the rest of the page, whatever size that might be?
This issue pops up from time to time. Presently I'm positioning an iframe next to a div. I want the div fixed width and the i frame to fill up the rest of the page.
Any help much appreciated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Feb 10th, 2006, 03:47
herkalees's Avatar
Highly Reputable Member
Join Date: Jul 2005
Location: Massachusetts, USA
Age: 87
Posts: 576
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Combining fixed and relative widths

An iFrame is a box and cannot wrap around an image. Text on the other hand isn't a box (unless its in it's own div) and can easily wrap around an image like this...

<p><img src="yay.jpg" alt="picture of a yay" style="float:left; margin:0 10px 10px 0;" />Text text text text text text text text text text text</p>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Feb 10th, 2006, 08:00
Junior Member
Join Date: Aug 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Combining fixed and relative widths

I should have been clearer. I don't want anything to wrap around the image. I just want it (an iframe, or div, or whatever) to fill the remaining width of the page.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Feb 10th, 2006, 09:57
Junior Member
Join Date: Aug 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Combining fixed and relative widths

I guess what I'm really asking is how to replicate something like this:
Code: Select all
<table width="100%">
<tr>
<td width="150"><img src="blah.jpg" width="150"></td>
<td>lots of text</td>
</tr>
</table>
Where the left cell is fixed and the right will be as wide as the rest of the screen.
But to do it without using tables.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Feb 10th, 2006, 12:10
masonbarge's Avatar
Highly Reputable Member
Join Date: Jan 2006
Location: Atlanta GA
Posts: 631
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Combining fixed and relative widths

Set the width of a container div at a percentage (like 95%) and float the left div at a stated width, either in pixels or ems. The right column will fill the container. You don't want to use relative positioning, because if the center column is longer than the left one, this will cause it to flow under the left one. Just set a fixed left margin for it and leave positioning at the static default.

Code: Select all
#wrap {width: 95%;}
#leftcol {width: 160px;  float: left;}
#maincol {margin-left: 162 px;}
This will shrink the main column as the page gets smaller. AFAIK you could set the leftcol at a % and they both would shrink.

Last edited by masonbarge; Feb 10th, 2006 at 12:13.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Feb 10th, 2006, 13:14
Junior Member
Join Date: Aug 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Combining fixed and relative widths

That's the trick!
I've used a similar method before and it ended up a bit shoddy, but this works great.
Thanks for the help!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
combining, fixed, relative, widths

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Advice on page widths etc sing2trees Web Page Design 7 Nov 21st, 2007 19:34
Help in combining two scripts jonnymorris JavaScript Forum 7 Jul 28th, 2007 15:20
100% widths snooper Web Page Design 5 Jul 12th, 2007 12:51
Need help combining 2 Javascripts seargentpepper7 JavaScript Forum 3 Jun 11th, 2007 19:22
A question about widths em vs px AdRock Web Page Design 5 Aug 15th, 2006 09:05


All times are GMT. The time now is 09:58.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42