Please help me in coding this section

Discussion in 'CSS' started by xcd125, Jun 18, 2011.

  1. #1
    Hello i am new to html/css coding, I need a small help in coding a part of my layout.
    Please take a look at this image http://i56.tinypic.com/5f2g4n.jpg

    How do i code this? Should i use separate classes for web design, e-commerce & social marketing or i should use tables to make it? Which one do you think will be professional?
     
    xcd125, Jun 18, 2011 IP
  2. Trix

    Trix Peon

    Messages:
    192
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    0
    #2
    Simple way....
    <table style="width:100%">
        <tr>
           <td width="33%">Block 1</td>
           <td width="33%">Block 2</td>
           <td width="33%">Block 3</td>
        </tr>
    </table>
    Code (markup):
    If u don't like using table, then use the following....
    
    <div style="width:100%">
        <div style="float:left; width:33%">Block 1</div>
        <div style="float:left; width:33%">Block 2</div>
        <div style="float:left; width:33%">Block 3</div>
        <div style="clear:both"></div>
    <div>
    
    Code (markup):
    Please separate the style from html. I have inlined the styles just for illustration.
     
    Trix, Jun 19, 2011 IP
  3. BRUm

    BRUm Well-Known Member

    Messages:
    3,086
    Likes Received:
    61
    Best Answers:
    1
    Trophy Points:
    100
    #3
    Percentages are known to be fiddly in CSS. Have you tested that 33% doesn't overflow Trix? I've had to use tenths of a percentage to get these things right.
     
    BRUm, Jun 25, 2011 IP
  4. TheMissingLink007

    TheMissingLink007 Peon

    Messages:
    785
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    just me shouldnt you know how to web design before you do a class?
     
    TheMissingLink007, Jun 25, 2011 IP
  5. Trix

    Trix Peon

    Messages:
    192
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    0
    #5
    If there is problem for %width... then give a fixed width for the outer table / div...... what do you think are people who have liquid layouts ?
     
    Trix, Jun 27, 2011 IP
  6. BRUm

    BRUm Well-Known Member

    Messages:
    3,086
    Likes Received:
    61
    Best Answers:
    1
    Trophy Points:
    100
    #6
    Hey, I used fluid layouts all the time. I've just had weird problems where 3 x 33% appears over 100%. So I had to reduce them to 32.9% or lower.
     
    BRUm, Jun 28, 2011 IP
  7. Trix

    Trix Peon

    Messages:
    192
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    0
    #7
    that problem will arise only if there is margin or padding or border or cellspacing or cellpadding is given (not sure though everything will cause it)..... if theresnt any it will not create problem... it should not.... 99% should not be problem....
     
    Trix, Jun 28, 2011 IP
  8. BRUm

    BRUm Well-Known Member

    Messages:
    3,086
    Likes Received:
    61
    Best Answers:
    1
    Trophy Points:
    100
    #8
    OK those are good points, but shouldn't width be relative anyway? Why would padding/margins affect something which should be a 100% percent of a space anyway?

    I'm going to try and recreate the problem.
     
    BRUm, Jun 28, 2011 IP