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 4 Column Float Layout
Old 02-28-2010, 05:40 PM CSS 4 Column Float Layout
MattGoucher's Avatar
Skilled Talker

Posts: 64
Name: Matt
Location: California
Trades: 0
Hey Webmasters,

Recently I stumbled upon how to create a four column layout using basic css, but I'm really curious why the order of the div elements placed in the HTML have to be ordered a specific way.

Does the positioning matter because of the way its parsed? As you can see in the HTML code, I ordered the div's in a weird way. I originally had them ordered in a way that would seem logical, but for some reason some of the elements were misplaced.

HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <title>Page title here</title>
    <meta name="DC.title" content="Title here" />
    <meta name="DC.subject" content="Keywords here" />
    <meta name="DC.description" content="Description here" />
    <meta name="DC.format" content="text/html" />
    <meta name="DC.publisher" content="Publisher here" />
    <meta name="DC.language" content="en" />
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
    <style type='text/css'>
    #Container {
        width:898px;
    }
    #left-Float {
        float:left;
        width:450px;
        height:265px;
        text-align:left;
        border:1px solid;
    }
    #l-left {
        float:left;
        width:210px;
        padding-left:5px;
        padding-right:5px;
        text-align:left;
        border:1px solid;
    }
    #l-right {
        float:right;
        width:210px;
        padding-left:5px;
        padding-right:5px;
        text-align:left;
        border:1px solid;
    }
    #right-Float {
        float:right;
        width:450px;
        height:265px;
        text-align:left;
        border:1px solid;
    }
    #r-left {
        float:left;
        width:215px;
        padding-left:5px;
        padding-right:5px;
        text-align:left;
        border:1px solid;
    }
    #r-right {
        float:right;
        width:215px;
        padding-left:5px;
        padding-right:5px;
        text-align:left;
        border:1px solid;
    }
    </style>
</head>
<body>
    <div id="Container">
        <div id="left-float">
            <div id="l-left">
                Left Left
            </div>
            <div id="r-right">
                Right Right
            </div>                   
        </div>
        <div id="right-float">
            <div id="r-left">
                Right Left
            </div>
            <div id="l-right">
                Left Right
            </div>       
        </div>
    </div>
</body>
</html>
validator.w3.org says:This document was successfully checked as XHTML 1.1!
__________________

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

Invalid Code On A New Website Is Like Having A New Car With A Broken Windshield
MattGoucher is offline
Reply With Quote
View Public Profile Visit MattGoucher's homepage!
 
 
Register now for full access!
Old 03-01-2010, 11:38 AM Re: CSS 4 Column Float Layout
Extreme Talker

Posts: 149
Trades: 0
try to remove all the extra divs...only put 4 divs for that 4 columns, and float all of them to the left
__________________
Free
Please login or register to view this content. Registration is FREE

Visit our
Please login or register to view this content. Registration is FREE
and
Please login or register to view this content. Registration is FREE
mimamo is offline
Reply With Quote
View Public Profile
 
Old 03-01-2010, 02:28 PM Re: CSS 4 Column Float Layout
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
You might want to read this:
http://www.positioniseverything.net/ordered-floats.html
__________________
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-01-2010, 06:51 PM Re: CSS 4 Column Float Layout
MattGoucher's Avatar
Skilled Talker

Posts: 64
Name: Matt
Location: California
Trades: 0
@mimamo

Removing the extra divs did something but not exactly what I was looking for, thanks for the ideas.

@LadynRed

I've been reading some of the posts you have made, amazing. That page was very informative. Bookmarked for sure, Thanks!

Also, I'm glad to see that there are others out there that stand for only valid code, makes me smile just a bit
__________________

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

Invalid Code On A New Website Is Like Having A New Car With A Broken Windshield
MattGoucher is offline
Reply With Quote
View Public Profile Visit MattGoucher's homepage!
 
Reply     « Reply to CSS 4 Column Float Layout
 

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