Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Page that fills the window horizontally?
Old 09-28-2007, 08:24 AM Page that fills the window horizontally?
Ultra Talker

Posts: 316
Trades: 0
Say I've got two DIV columns, side by side.

I want one to be 200px on the right and the other to be X% of the space that is left on the right, how would I do that?
t the moment I have this:


Code:
.middle {
    float: left;
    width: *%;
    margin-left: 0px;
    margin-right: 15px;
    padding: 1% 1%;
    text-align: justify;
}

.right {
    float: left;
    width: 200px;
    margin: 0 10px;
    padding: 1% 1%;
    text-align:left;
    
}

This is putting the right div underneath the middle div.

I would like them both on the same horizontal plane.

Thanks
Joe3000 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-28-2007, 08:42 AM Re: Page that fills the window horizontally?
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
I don't think that you can do any computing in css, and if it's floated, it's outside of the normal fow, so it won't work....

Maybe by using inline elements, and not block elements you could do that.
Something like 2 span, 1 being 200px and the other being 100%, but the 2 being not floated nor positioned...

I don't know if this can work, I'm just doing a proposal...

Edit:
Nah... I just tried it, it don't work. Inline elements cannot have a width.
In that case, the easiest way would be to use a table, I'd say.
As it would have 1 cell 200px, and the other would grow to the size available...
Code:
table
+-------+-----------------+
| <div> |      <div>      |
| 200px |       100%      |
+-------+-----------------+
__________________
Only a biker knows why a dog sticks his head out the window.

Last edited by tripy; 09-28-2007 at 08:52 AM..
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 09-28-2007, 10:09 AM Re: Page that fills the window horizontally?
maxxximus's Avatar
Extreme Talker

Posts: 219
Name: Rob
Location: UK
Trades: 0
You need to use the negative margin trick.

Belows the code for a sidebar on the right of 200px. The main content fills the rest of the page on the left. When you resize the browser the sidebar stays on the right and the content contracts but always fills the available space.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--

#content {
    background-color: #FF0000;
    float: left;
    padding:0 220px 0 0;


}

#sidebar {
    background-color:#00FFCC;
    float: left;
    width: 200px;
    margin:0 0 0 -205px;
    
}
-->
</style>
</head>

<body>

<div id="content">Main content</div>
<div id="sidebar">Right sidebar coloured green</div>

</body>
</html>
maxxximus is offline
Reply With Quote
View Public Profile
 
Old 09-29-2007, 01:20 PM Re: Page that fills the window horizontally?
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
Nooooooooooo.. no tables for layout !!

Maxxximus has a good solution.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 09-29-2007, 03:06 PM Re: Page that fills the window horizontally?
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Quote:
Originally Posted by LadynRed View Post
Nooooooooooo.. no tables for layout !!

Maxxximus has a good solution.


I knew I was getting hit for that....
And I will really use maxxximus solution in the future, but I've already used the "table" solution for sites I've done in the paste, because of this.

The negative margin is not something that come instinctively to my mind.
That, and I'm more a programmer than a designer....
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 09-30-2007, 12:08 PM Re: Page that fills the window horizontally?
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
I have a site that has a fixed-width column on the left and a semi-stretchy right column (semi in that it's only allowed to stretch to 1000px). It works very well and no negative margins, which I find can be complicated to manage.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Page that fills the window horizontally?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.36082 seconds with 12 queries