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
DIV tag help (positioning)
Old 01-13-2009, 11:15 PM DIV tag help (positioning)
Average Talker

Posts: 18
Trades: 0
Hello everyone... i am going to apologize to everyone ahead of time... i am sure that this question have been asked (ans answered) plenty of times in the past around here...

in any case, i am trying to get 3 boxes lined (in one row) up at the bottom on my pages, each one being 30% width.... I figured out that i need 3 DIV classes (or types)... one for left, one for center, and one for right...

My CSS skills are "suck" at best, so i was wondering if somebody here would give me some help as to what parameters i need to use in the SCC portion of my code to build the DIV tags for my 3 boxes...

ohh, and here is a link to a page with a webmaster who actually knows how ot do it... (i am trying to make the same boxes as they have for "Appointments" "Don't Pay" and our "Quality")
http://www.robbinsbros.com/

If anyone could clue me in on this top secret... i'd much apreciate it...
agent_KGB is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-13-2009, 11:58 PM Re: DIV tag help (positioning)
stevej's Avatar
Professional Multitasker

Posts: 996
Location: Not positive
Trades: 0
It's pretty simple actually. Here is something that I just wrote up real quick.

CSS
Code:
<style type="text/css">
.container {
width: 600px;
height: 100px;
border: 1px solid #000;
}
#left {
float: left;
width: 170px;
border: 1px solid #000;
height: 100px;
}
#center {
margin-left: 45px;
float: left;
width: 170px;
border: 1px solid #000;
height: 100px;
}
#right {
float: right;
width: 170px;
border: 1px solid #000;
height: 100px;
}
</style>
HTML Code:
<div class="container">
<div id="left">
left
</div>
<div id="center">
middle
</div>
<div id="right">
right
</div>
</div>
This may not be the best way to do it, but when I looked at the source code of the Robbins Bros website, I found that this is just about the same concept.

Hope it helps!
- Steve
stevej is offline
Reply With Quote
View Public Profile
 
Old 01-14-2009, 12:55 AM Re: DIV tag help (positioning)
johniman7's Avatar
President, JLI Media

Posts: 965
Name: John Irving
Trades: 0
And you can change Steve's code easily to use %s just change 170px after the widths to 33%.
__________________
Cheers, John Irving: My Blog
JLI Media:
Please login or register to view this content. Registration is FREE
| Website Development (Link Coming Soon!)
johniman7 is offline
Reply With Quote
View Public Profile Visit johniman7's homepage!
 
Old 01-14-2009, 11:13 AM Re: DIV tag help (positioning)
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
That margin-left with the float:left on the #center div will trigger a margin-doubling bug in IE6, so you'll need to be careful of that. You either have to alter the coding to get around it so you don't trigger the bug, or you'll need to use conditional comments to call a separate 'fixes' css file for IE6 which would contain this code:

#center{display: inline;} - that fixes the bug.
__________________
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 01-14-2009, 12:40 PM Re: DIV tag help (positioning)
stevej's Avatar
Professional Multitasker

Posts: 996
Location: Not positive
Trades: 0
Quote:
That margin-left with the float:left on the #center div will trigger a margin-doubling bug in IE6, so you'll need to be careful of that.
Thanks for the warning LadynRed. However, I've tested it out and it does not, in fact, trigger that problem. I don't know why.
stevej is offline
Reply With Quote
View Public Profile
 
Old 01-14-2009, 03:45 PM Re: DIV tag help (positioning)
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
Strange, because those are the exact circumstances that will trigger that bug in IE6.
__________________
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 01-14-2009, 05:38 PM Re: DIV tag help (positioning)
Average Talker

Posts: 18
Trades: 0
You guys rock!!!
agent_KGB is offline
Reply With Quote
View Public Profile
 
Old 01-14-2009, 06:02 PM Re: DIV tag help (positioning)
Average Talker

Posts: 18
Trades: 0
... unfortunately even though you guys do rock, i am still having some problems....

maybe somebody can help me out... i have two files (index.html and index.css)... i placed your code in my css file (with few minor changes) so now it looks like this:

Code:
.addcontainer {
width: 600px;
height: 100px;
border: 1px solid #000;
}
#addleft {
float: left;
width: 33%;
border: 1px solid #000;
height: 100px;
}
#addcenter {
display: inline;
margin-left: 45px;
float: left;
width: 33%;
border: 1px solid #000;
height: 100px;
}
#addright {
float: right;
width: 33%;
border: 1px solid #000;
height: 100px;
}
and added this portion to my HTML (right above </body> tag)

Code:
<div class="addcontainer">
<div id="addleft">
left
</div>
<div id="addcenter">
middle
</div>
<div id="addright">
right
</div>
</div>

 
<hr class="cleaner" />
any reason i would end up with left box in it's own row, and middle and right in a row under it?
agent_KGB is offline
Reply With Quote
View Public Profile
 
Old 01-14-2009, 06:05 PM Re: DIV tag help (positioning)
stevej's Avatar
Professional Multitasker

Posts: 996
Location: Not positive
Trades: 0
It's because the width of all the divs, including all the borders, is wider than 600px. Get rid of margin-left: 45px;

- Steve

Last edited by stevej; 01-14-2009 at 06:09 PM..
stevej is offline
Reply With Quote
View Public Profile
 
Old 01-14-2009, 08:34 PM Re: DIV tag help (positioning)
Average Talker

Posts: 18
Trades: 0
As expected... you were right on with a solution... thanks - Steve... you the man!!!
agent_KGB is offline
Reply With Quote
View Public Profile
 
Old 01-14-2009, 09:21 PM Re: DIV tag help (positioning)
Brian07002's Avatar
Defies a Status

Posts: 2,140
Name: ...
Location: ...
Trades: 0
Just have to quote this message

Quote:
... unfortunately even though you guys do rock, i am still having some problems....
That's the way it goes...
__________________
Made2Own

Please login or register to view this content. Registration is FREE
Brian07002 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to DIV tag help (positioning)
 

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