Div Column

Discussion in 'HTML & Website Design' started by Harmony, Jun 8, 2006.

  1. #1
    Hi guys,
    I am using <div> for this page: http://www.postdotcom.com/directorylist.php
    for the Free Directories Column. I would like to make another column right next to it for another category, how do I do this properly? Is it possible with <div>?
     
    Harmony, Jun 8, 2006 IP
  2. brian394

    brian394 Well-Known Member

    Messages:
    226
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    108
    #2
    Well, there are multiple ways of doing it. Would you prefer the easy way or the hard way? :D

    First, let's start off with the easy way.

    CSS
    
    div#first_column {
     float: left;
     margin-right: 15px;
    }
    
    div#second_column {
     float: left;
    }
    
    Code (markup):
    HTML
    
    <div id="first_column">
     Free Directories:
     ...
    </div>
    
    <div id="second_column">
     Second column text goes here
    </div>
    
    Code (markup):
    If that doesn't work, you can try the hard way...

    CSS
    
    div#container { 
     width: 280px;
     position: relative;
    }
    
    div#first_column {
     width: 130px;
     position: absolute;
     top: 0px;
     left: 0px;
    }
    
    div#second_column {
     width: 130px;
     position: absolute;
     top: 0px;
     right: 0px;
    }
    
    Code (markup):
    HTML
    
    <div id="container">
     <div id="first_column">
      Free Directories:
      ...
     </div>
     <div id="second_column">
      Second column text goes here
     </div>
    </div>
    
    Code (markup):
    If you get stuck you can always fall back to HTML tables as a last resort. ;)
     
    brian394, Jun 9, 2006 IP
  3. Harmony

    Harmony Well-Known Member

    Messages:
    1,846
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    120
    #3
    Hi, thanks for the code. But I got this error :

    Fatal error: Smarty error: [in directorylist.tpl line 29]: syntax error: unrecognized tag: width: 130px; position: absolute; top: 0px; left: 0px; (Smarty_Compiler.class.php, line 436) in /home/postdotc/public_html/libs/smarty/Smarty.class.php on line 1088

    for each of them, but maybe a different error but about the same, an error =|
     
    Harmony, Jun 9, 2006 IP
  4. SiteExpress

    SiteExpress Well-Known Member

    Messages:
    1,355
    Likes Received:
    153
    Best Answers:
    0
    Trophy Points:
    155
    #4
    I think you may have mistakenly placed the css in your tpl file. It either needs to go into a css sheet, or in the header as a style.
     
    SiteExpress, Jun 9, 2006 IP
  5. Harmony

    Harmony Well-Known Member

    Messages:
    1,846
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    120
    #5
    I guess so, its actually not a mistake but thats where all my codes go, including the current column I have on the page.

    What should I do instead?
     
    Harmony, Jun 9, 2006 IP
  6. SiteExpress

    SiteExpress Well-Known Member

    Messages:
    1,355
    Likes Received:
    153
    Best Answers:
    0
    Trophy Points:
    155
    #6
    If this is php Link Directory, just place the styles in the main.css file
     
    SiteExpress, Jun 9, 2006 IP
    Harmony likes this.
  7. Harmony

    Harmony Well-Known Member

    Messages:
    1,846
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    120
    #7
    Oh yes, *hits self on head*
    I guess Im losing it today. Definitly missed that, thanks :)
     
    Harmony, Jun 9, 2006 IP