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
positioning 2 div containers in main container
Old 05-03-2008, 12:23 PM positioning 2 div containers in main container
Skilled Talker

Posts: 55
Name: Adrian
Trades: 0
I have been trying to place div containers into a main content div container. When I place the containers I have trouble as they don't want to align evenly, I've tried using absolute and relative on the 2 div containers but either one floats to the right or overlaps the other.

I have main div content container: (contentWrapper)
centered on page
width: 957px
height: 342px

left div container: (leftContent)
width: 313px
height 320px
margin: 19px 0 81px 32px

right div container: (rightContent)
width: 494px
height: 342px
margin: 19px 71px 30px 0

So basically its a main content container with 2 column containers inside of it.

I have tried coding it like this:

html:

<div id="contentWrapper">
<div id="leftContent">Left Content Blah Blah Blah </div>
<div id="rightContent">Right Content Content Blah Blah Blah </div>
</div>


css:

#contentWrapper {
border: 1px solid black;
height: 342px;
width: 957px;
margin: 0 auto;
position:relative;
}

#leftContent {
position:absolute;
top:0;
left:0;
width:313x;
height:320px;
border: 1px solid red;
}

#rightContent {
position:absolute;
top:0;
right:0;
width:494x;
height:342px;
border: 1px solid red;
}


What happens to the boxes is that they are not proportional to the sizes I have given them and I want to be able to move them inside the main content container so I can have the padding of 32px from left side and padding of 71 from right side. Not sure if the correct way is to use padding or margins to position the entire 2 containers inside the main container?

Please someone let me know if I'm coding this the correct way through CSS? Thanks.
elv8 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-03-2008, 01:05 PM Re: positioning 2 div containers in main container
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Get RID! of the position absolutes and float left the two containers inside the wrapper, use position relative on the wrapper and the left container and use margins to set the right container.

clear the floats before closing then wrapper element.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-03-2008, 01:21 PM Re: positioning 2 div containers in main container
Skilled Talker

Posts: 55
Name: Adrian
Trades: 0
I have done as you said but as a result I get the left container on the top and the right container on the bottom instead of the 2 containers side by side?
elv8 is offline
Reply With Quote
View Public Profile
 
Old 05-03-2008, 01:34 PM Re: positioning 2 div containers in main container
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
is the code you posted the actual code from the site you're building? Because there are two typos: "width:313x;" should be "width: 313px;" and "width:494x;" should be "width: 494px"
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is online now
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 05-03-2008, 01:46 PM Re: positioning 2 div containers in main container
Skilled Talker

Posts: 55
Name: Adrian
Trades: 0
It is 3am and yes I did typo, now is all fine and working!!!

Thank you for your help!!! :-)
elv8 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to positioning 2 div containers in main container
 

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.50611 seconds with 12 queries