Making my page 3 column CSS

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TheServant
    Recognized Expert Top Contributor
    • Feb 2008
    • 1168

    Making my page 3 column CSS

    Hey guys,
    I am trying to get my page to be 3 columns, with a liquid center one.

    The CSS concerned is:
    [CODE=CSS]div.container {
    width: 100%;
    margin: 0 auto;
    border: 0px;
    }
    div.center_cont ent {
    background-color:#0033FF;
    position: relative;
    left: 200px;
    float: left;
    }
    div.left_conten t {
    background-color:#770000;
    width: 200px;
    left: 0;
    position: relative;
    float: left;
    }
    div.right_conte nt {
    background-color:#7733FF;
    width: 200px;
    right: 0;
    position: relative;
    float: right;[/CODE]

    The html:
    [HTML]<div class="containe r">
    <div class="left_con tent">
    <p>Left Content</p>
    <some code />
    </div>
    <div class="center_c ontent">
    <p>Center Content</p>
    <some code />
    </div>
    <div class="right_co ntent">
    <p>Right Content</p>
    <some code />
    </div>
    </div>[/HTML]

    Basically I want the middle column to fill all the space between the left and right (fixed-width) columns, but I can't seem to get the CSS right for center_content.
  • harshmaul
    Recognized Expert Contributor
    • Jul 2007
    • 490

    #2
    Your always going to get this problem unless you use fixed sizes for everything.

    Either use pixels as the measure or percent. not both.


    heres two style for youto see what i mean

    Code:
    div.container {
        width: 800px;
        margin: 0 auto;
        border: 0px;
    }
    div.center_content {
        background-color:#0033FF;
        width: 600px;
        float: left;
    }
    div.left_content {
        background-color:#770000;
        width: 200px;
        float: left;
    }
    div.right_content {
        background-color:#7733FF;
        width: 200px;
        float: left;
    }

    Code:
    div.container {
        width: 100%;
        margin: 0 auto;
        border: 0px;
    }
    div.center_content {
        background-color:#0033FF;
        width: 60%;
        float: left;
    }
    div.left_content {
        background-color:#770000;
        width: 20%;
        float: left;
    }
    div.right_content {
        background-color:#7733FF;
        width: 20%;
        float: left;
    }

    Comment

    • TheServant
      Recognized Expert Top Contributor
      • Feb 2008
      • 1168

      #3
      This guy has done it, but I want to know why you need all the container div's:
      Holy Grail 3

      His CSS goes like:
      [CODE=CSS].holygrail {
      background:#FFF F99 none repeat scroll 0%;
      }
      .holygrail .colmid {
      background:#FFF FFF none repeat scroll 0%;
      float:left;
      margin-left:-200px;
      position:relati ve;
      right:100%;
      width:200%;
      }
      .holygrail .colleft {
      background:#FFD 8B7 none repeat scroll 0%;
      float:left;
      left:400px;
      margin-left:-50%;
      position:relati ve;
      width:100%;
      }
      .holygrail .col1wrap {
      float:left;
      padding-bottom:1em;
      position:relati ve;
      right:200px;
      width:50%;
      }
      .holygrail .col1 {
      left:200%;
      margin:0pt 215px;
      overflow:hidden ;
      position:relati ve;
      }
      .holygrail .col2 {
      float:right;
      position:relati ve;
      right:15px;
      width:170px;
      }
      .holygrail .col3 {
      float:right;
      left:50%;
      margin-right:45px;
      position:relati ve;
      width:170px;
      }[/CODE]

      His html:
      [HTML]<div class="colmask holygrail">
      <div class="colmid">
      <div class="colleft" >
      <div class="col1wrap ">
      <div class="col1">
      {..code..}
      </div>
      </div>
      <div class="col2">
      {..code..}
      </div>
      <div class="col3">
      {..code..}
      </div>
      </div>
      </div>
      [/HTML]

      Comment

      • drhowarddrfine
        Recognized Expert Expert
        • Sep 2006
        • 7434

        #4
        Though CSS is the best way to layout a page, when you go for general-purpose and ultimate flexibility, everything must be accounted for. And when you have to include all the "IE fixing", the markup can get pretty big.

        iow, a baby's gotta do what a baby's gotta do! (Who can tell me what that line is from?) :)

        Comment

        • harshmaul
          Recognized Expert Contributor
          • Jul 2007
          • 490

          #5
          sounds like something tommy would say from rugrats.

          Comment

          • drhowarddrfine
            Recognized Expert Expert
            • Sep 2006
            • 7434

            #6
            Your favorite show, too?! :)

            Comment

            • TheServant
              Recognized Expert Top Contributor
              • Feb 2008
              • 1168

              #7
              OK, so all that is necessary. I thought so, but hoped I could find a way to get by the fixes. Thanks for you help guys.

              Comment

              • Markus
                Recognized Expert Expert
                • Jun 2007
                • 6092

                #8
                Originally posted by drhowarddrfine
                Your favorite show, too?! :)
                I absolutely hated angelica.
                Always thwarting tommy n the gangs plans.
                >=[

                Comment

                Working...