<div> Troubles

Status
Not open for further replies.

Penguin129

New Member
Messages
68
Reaction score
0
Points
0
Ok so I have one div as a container with 2 divs inside.
----------------
|.....|...........|
|left|..right..|
|.....|...........|
----------------
Here's the css I need help with.
Code:
div.container {
	min-width: 780px;
}
div.left {
	float: left;
	width: 90px;
}
div.right {
	float: right;
}
How would I go about making the div on the right scale with the rest of it? Also, I know it can be done with a table but I would like to avoid tables for this.
 
Last edited:

dcoates

New Member
Messages
129
Reaction score
0
Points
0
Your divs I belive should be

<div align="right">

or <div align="left">

you should always start your div as <div> and end with </div>
 

Tau_Zero

New Member
Messages
19
Reaction score
0
Points
0
For the right div, try width:100%, and if it appears to be too wide (does with of the container div without subtracting the left div), try width:100%-90px
The latter is not proper CSS, but it's helped me out of a bind once or twice
 

curt15

New Member
Messages
96
Reaction score
0
Points
0
div.container {
width:100%;
}
div.left {
float: left;
width: 10%;
}
div.right {
float: right;
width: 10%;
}

Alternatively

div.container {
width:1024px;
}
div.left {
float: left;
width: 10%;
}
div.right {
float: right;
width: 10%;
}

And put <center> before you use the div and </center> afterwards. The conainter will float in the center of the page, and the other elements will position according to what the CSS says.
 

kajasweb

New Member
Messages
1,723
Reaction score
0
Points
0
Try this..

Code:
#main {
	width: 800px;
}
#main .right {
	float: right;
	width: 575px;
}
#main .left {
	float: left;
	width: 180px;
}
 
Last edited:

Penguin129

New Member
Messages
68
Reaction score
0
Points
0
Erm I think I need to clarify what I wanted. I have a div that has it's width set to 100% and inside it are 2 divs that are side by side. The div on the left should be a fixed width while the div on the right should stretch with the container. Thanks for trying anyways.
 

Sohail

Active Member
Messages
3,055
Reaction score
0
Points
36
Maybe you should get rid of CSS and go for HTML using the <p align="(left/right)">(content here)</p> tags. Hope this helps...
 

Penguin129

New Member
Messages
68
Reaction score
0
Points
0
I don't see how that helps at all, but anywho I figured it out. Thank you w3.org! :p Thanks for trying anyways.
 
Last edited:
Status
Not open for further replies.
Top