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
css layout with padding
Old 03-23-2008, 10:14 AM css layout with padding
MattCoops's Avatar
Ultra Talker

Posts: 423
Name: Matt Cupan
Location: Charlotte, NC
Trades: 0
how would I achieve this in css:
Attached Images
File Type: jpg screen.jpg (13.5 KB, 10 views)
__________________
Matt - Tweeting
Please login or register to view this content. Registration is FREE


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

read my
Please login or register to view this content. Registration is FREE
MattCoops is offline
Reply With Quote
View Public Profile Visit MattCoops's homepage!
 
 
Register now for full access!
Old 03-23-2008, 11:29 AM Re: css layout with padding
Super Talker

Posts: 107
Name: Sandy
Trades: 0
Hi Matt,

I just created this on the fly. I think this is what you are looking for, I'm not sure. You can adjust the padding/margins as you like. I think you meant to say that you are wanting 20px margin around each box. The padding is withing the box, taking the text away from the outter edge. I included padding in it as well. I put it through browswershots as well:

http://browsershots.org/http://sandy...om/4boxes.html

Good Luck! Here it is:

http://sandysdesignline.com/4boxes.html
__________________
Sandy K
sandyk3 is offline
Reply With Quote
View Public Profile
 
Old 03-23-2008, 01:48 PM Re: css layout with padding
MattCoops's Avatar
Ultra Talker

Posts: 423
Name: Matt Cupan
Location: Charlotte, NC
Trades: 0
That looks good in other browsers, but in IE has no seperation in header boxes at top.

More than 90% of this site's users will be using IE.
__________________
Matt - Tweeting
Please login or register to view this content. Registration is FREE


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

read my
Please login or register to view this content. Registration is FREE
MattCoops is offline
Reply With Quote
View Public Profile Visit MattCoops's homepage!
 
Old 03-23-2008, 02:31 PM Re: css layout with padding
Super Talker

Posts: 107
Name: Sandy
Trades: 0
Hi Matt,

I am trying myself to understand the hack for this. LadynRed suggested this site:
http://www.positioniseverything.net/
As a beginner it's hard for me to understand this. Maybe you can understand it better than me. Please, if you find out how to hack this, will you please post it. I'll be watching this post. I will also still be trying to correct it as well.
__________________
Sandy K
sandyk3 is offline
Reply With Quote
View Public Profile
 
Old 03-24-2008, 12:23 AM Re: css layout with padding
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
I'll have to take a crack at it in the AM when I"m not so tired.
One thing I did see is that you're triggering the doubled-float margin bug when you have float:left then apply a margin-left - IE6 will DOUBLE the margin (same goes for float:right, margin-right).

The solution is to add display:inline to the floated box but do it in a separate CSS file that you then call with conditional comments - which only IE reads.
__________________
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 03-24-2008, 10:48 AM Re: css layout with padding
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Ok, try this instead:

Main CSS file:
Quote:
body {
text-align: center;
margin: 0;
padding: 0;
}
#box1, #box3, #box4, #box1and2, #box3and4{
margin: 0;
padding: 0;
}
#wrapper {
font-family: Arial, Helvetica, sans-serif;
font-size: 80%;
color: #000000;
background-color: #999999;
text-align: justify;
width: 800px;
border: thin solid #000000;
/*height: 500px;*/
position: relative;
margin: 0 auto;
}
#box1and2 {
height: 150px;
/*width: 800px;*/
margin: 20px 0;

}
#box1 {
text-align: justify;
height: 150px;
width: 210px;
border: thin solid #000000;
float: left;
margin: 0 20px;
background-color: #9966FF;
}
#box1 p, #box2 p, #box3 p, #box4 p{
padding: 3px 10px;
}

#box2 {
width: 530px;
border: thin solid #000000;
height: 150px;
background-color: #CCFF66;
margin: 0 0 0 245px;
}

#box3and4 {
height: 340px;

}
#box3 {
height: 300px;
width: 210px;
border: thin solid #000000;
float: left;
margin-right: 20px;
margin-left: 20px;
background-color: #3399CC;
}
#box4 {
height: 300px;
width: 530px;
border: thin solid #000000;
margin-left: 245px;
background-color: #66FF66;

}

.brclear { /* Use a break with this class to clear float containers on both sides */
clear:both;
height:0;
margin:0;
font-size: 1px;
line-height: 0;
}
IE fixes css file:
Quote:
/*kills the doubled-float margin bug */
#box1, #box3{
display: inline;

}
HTML
Quote:
<!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>

<link href="4boxes_files/4boxes.css" rel="stylesheet" type="text/css">
<!--[if lt IE 7]>
<link href="4boxes_files/iefixes.css" rel="stylesheet" type="text/css" /> <![endif]-->
<!--[if gt IE 6]>
<link href="4boxes_files/ie7fixes.css" rel="stylesheet" type="text/css" /> <![endif]-->

</head>
<body>
<div id="wrapper">
<div id="box1and2">
<div id="box1"><p>some text or possible the logo for the company</p></div>

<div id="box2"><h1>Headline for the company or a banner</h1></div>
</div>
<div id="box3and4">
<div id="box3"><p>Sidebar for links</p></div>
<div id="box4"><p>content for each page</p>
<p>Whatever you want you can put in here</p></div>
</div>

</div>
</body>
</html>
Works in Firefox and IE 6
__________________
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 03-25-2008, 09:08 AM Re: css layout with padding
MattCoops's Avatar
Ultra Talker

Posts: 423
Name: Matt Cupan
Location: Charlotte, NC
Trades: 0
That is outstanding. Thank you LadyNRed.
Do you have a link to a portfolio or something that we can give credit to you for layout?
__________________
Matt - Tweeting
Please login or register to view this content. Registration is FREE


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

read my
Please login or register to view this content. Registration is FREE
MattCoops is offline
Reply With Quote
View Public Profile Visit MattCoops's homepage!
 
Old 03-25-2008, 01:23 PM Re: css layout with padding
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
You're welcome. No, I don't currently have a portfolio, but I appreciate the thought
__________________
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 03-25-2008, 11:13 PM Re: css layout with padding
Super Talker

Posts: 107
Name: Sandy
Trades: 0
Hi Matt and LadynRed,

She beat me to the answer, LOL. I am trying to learn from LadynRed and I did come up with a different answer. It works in all browsers as I put it through browsershots.org.

http://sandysdesignline.com/4boxes1.html

The margins are off and so is the padding because I was playing with it and when I finally got it, I was excited!!

My two cents...
__________________
Sandy K
sandyk3 is offline
Reply With Quote
View Public Profile
 
Old 03-25-2008, 11:46 PM Re: css layout with padding
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
There's almost always more than one way to do a layout.. different people have different approaches. As long as it works, you're good ! Good job, Sandy !
__________________
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 css layout with padding
 

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.51227 seconds with 13 queries