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
How to create two boxs taking up 50% each.
Old 06-24-2010, 07:49 PM How to create two boxs taking up 50% each.
Novice Talker

Posts: 14
Name: robin brunet
Trades: 0
I would like to create two boxes to place text in each only taking up half of the screen. I would like to use a padding of 15px around each box and have them vertically centered within my given space and each box only 300px high. The best I can come up with is what I have below but that dose not work. Please help. Thanks.

box.410
{width:50%;
height:300px;
padding:15px;
margin:0 auto;}

and

box.420
{width:50%;
height:300px;
padding:15px;
float:right;
margin:0 auto;}
robin b is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-24-2010, 08:03 PM Re: How to create two boxs taking up 50% each.
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
A 300px box with 15px of padding is going to be a total height of 330px (300+15+15). The width would be whatever your 50% width number is plus those 30px of padding you're adding.

So, in order to have the boxes ONLY take up 50% of the width, you're going to have to make them smaller than 50% then add the padding to then equal 50% total width.
__________________
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 06-24-2010, 08:10 PM Re: How to create two boxs taking up 50% each.
Novice Talker

Posts: 14
Name: robin brunet
Trades: 0
Quote:
Originally Posted by LadynRed View Post
A 300px box with 15px of padding is going to be a total height of 330px (300+15+15). The width would be whatever your 50% width number is plus those 30px of padding you're adding.

So, in order to have the boxes ONLY take up 50% of the width, you're going to have to make them smaller than 50% then add the padding to then equal 50% total width.

The width of the space I am working with can't be done that way because it changes depending of the resolution of the persons screen. The height is also undetermined because it too changes depending on resolution.
robin b is offline
Reply With Quote
View Public Profile
 
Old 06-24-2010, 08:25 PM Re: How to create two boxs taking up 50% each.
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
What I was trying to tell you is that 50% PLUS padding is no longer 50%, it's more than 50%, so you're going to have things moving around because the total width of your boxes will be wider than their parent container.

Padding is added to the width of the box, it doesn't go inside it. You will have to adjust your calculations, or your layout, to compensate.
__________________
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 06-24-2010, 08:48 PM Re: How to create two boxs taking up 50% each.
Novice Talker

Posts: 14
Name: robin brunet
Trades: 0
Quote:
Originally Posted by LadynRed View Post
What I was trying to tell you is that 50% PLUS padding is no longer 50%, it's more than 50%, so you're going to have things moving around because the total width of your boxes will be wider than their parent container.

Padding is added to the width of the box, it doesn't go inside it. You will have to adjust your calculations, or your layout, to compensate.

The reason I was trying to do this is to replace my tables I am using right now on my index page is because my tables only center in IE and do not center in Firefox. They are invisible but you will get the idea when you see the text.

The page is http://robinsden.co.cc
robin b is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How to create two boxs taking up 50% each.
 

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