Why Am I Using Css Instead Of Tables??

Discussion in 'HTML & Website Design' started by TonyArmani, May 27, 2008.

  1. Ulquiorra

    Ulquiorra Peon

    Messages:
    422
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #21
    Just go with what's best for the situation. For example, there is no point in using CSS for tabular display of data.

    Anyway, what you did could have been done better using CSS itself.
     
    Ulquiorra, May 28, 2008 IP
  2. blueparukia

    blueparukia Well-Known Member

    Messages:
    1,564
    Likes Received:
    71
    Best Answers:
    7
    Trophy Points:
    160
    #22
    How can people use tables for layouts?

    I've never been able to do it. I've made sites before where I've used tables to display SQL results, forms, or parts of a site where using divs would use too much code.

    But doing a whole layout in tables? It so....inflexible. When I make a site, I like to never have to see the HTML file again, or open up a PHP file and find tidbits of generated code to edit, which is why CSS is so good - just open up the file, make a change and voila.

    Say I had a 2 columned layout - you do it in tables, and you suddenly decide that you eant the columns the other way round - you go into it, and cut the table cell, and paste it somewehre else, or I can do it with divs and CSS, and just go into the CSS file, and change the float order.

    Tables make things so much harder to customize - 2 lines of CSS on a div, or f**king around with rows and cells to get the desired effect, which will probably mean I have to add more CSS to the table to get it looking good.

    Use what you will, divs are just soooo much quicker and easier to code with than tables.


    
    <div id="header" style="width:780px;>
    <div id="header_left" style="float:left; width:20px">Left Side</div>
    <div id="header_middle" style="float:left; width:740px">Middle header</div>
    <div id="header_right" style="float:right; width:20px">Right Top</div>
    </div>
    Code (markup):
    Ummm...yeah that makes sense, it should look like:

    
    <div>
    
    	<div id="header_left">
    		Left Side
    	</div>
    	
    	<div id="header_middle">
    		Middle header
    	</div>
    	
    	<div id="header_right">
    		Right Top
    	</div>
    	
    </div>
    Code (markup):
    which is easier to read, style and edit than tables. Or you could just assign an ID to the top div, and leave the others ID-less. If you are going to assign an ID to a tag, then why are you going to put a style on it? It makes no sense. If it was a class, perhaps, since you may want it to behave slightly differently than others of the same class...but meh.
     
    blueparukia, May 28, 2008 IP
  3. rochow

    rochow Notable Member

    Messages:
    3,991
    Likes Received:
    245
    Best Answers:
    0
    Trophy Points:
    240
    #23
    I think it was for reference, but you're right it doesn't make sense.

    That's what multiple classes are for ;)
     
    rochow, May 28, 2008 IP