css and HTML layout

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • milas57
    New Member
    • May 2007
    • 14

    css and HTML layout

    hello everyone
    which one is better <div> or table for presentation and why please? thank you
  • harshmaul
    Recognized Expert Contributor
    • Jul 2007
    • 490

    #2
    Hi Divs are better. DrHoward said it best in this forum...


    Comment

    • drhowarddrfine
      Recognized Expert Expert
      • Sep 2006
      • 7434

      #3
      Neither.

      In ancient days, people used tables for layout because it was the only thing that worked, but tables were never designed for layout and, now that there are better ways, using tables for layout is stupid (see article titled that under Howtos at the top of this page).

      A <div> element is one used to provide structure to a page and group common elements together. It is never an automatic decision to use one anywhere unless it's necessary. Some pages can contain none at all.

      Laying out a web page is done with CSS and the normal flow of all html elements on a page. The question of which to use, tables or divs, is not one worth asking.

      Comment

      • angkana
        New Member
        • Feb 2008
        • 15

        #4
        I have websit about Practical CSS Layout Tips, Tricks, & Techniques.


        Think you need HTML tables to craft complex liquid layouts? Not so! In this tip-packed tutorial, Mark Newhouse shares advanced yet practical CSS techniques any working web designer can use.



        Best Regards,
        Angkana Jivaphaiboolsak

        Comment

        • drhowarddrfine
          Recognized Expert Expert
          • Sep 2006
          • 7434

          #5
          The article is old but contains advice that is still true today. Thank you.

          Comment

          • TheServant
            Recognized Expert Top Contributor
            • Feb 2008
            • 1168

            #6
            From what I have read, you cannot replace tables with CSS? I use both on my site, and I have tried to get the same control over the placement of information (and backgrounds) using CSS instead of tables, but due to lack of experience I can't just yet.

            I guess what I am asking is: Can I do the same with CSS as I can with tables, and will it be better?

            Comment

            • drhowarddrfine
              Recognized Expert Expert
              • Sep 2006
              • 7434

              #7
              What you have to do is quit thinking in "tables mode". That's what I find most people trying to do is get CSS to act like a table when a table isn't necessary in the first place.

              Anything tables can do with layout, CSS can do better.

              Comment

              • TheServant
                Recognized Expert Top Contributor
                • Feb 2008
                • 1168

                #8
                To get something like rounded borders, you need something like tables, <div>'s or even <p>'s I think. But this is really just replacing <td>'s with <div>'s? Really, the rest it fine, I think CSS is definately better with elastic and fluid page designs, I am only struggling with the look of my content borders.

                Comment

                • drhowarddrfine
                  Recognized Expert Expert
                  • Sep 2006
                  • 7434

                  #9
                  Tables are just pre-laid out grids you are confined to. divs are not. You don't have to use the borders that come with CSS. You can create your own with an image editor like Photoshop and use it as a background image or place them along the edges.

                  Comment

                  • TheServant
                    Recognized Expert Top Contributor
                    • Feb 2008
                    • 1168

                    #10
                    Originally posted by drhowarddrfine
                    Tables are just pre-laid out grids you are confined to. divs are not. You don't have to use the borders that come with CSS. You can create your own with an image editor like Photoshop and use it as a background image or place them along the edges.
                    I do use photoshop, but to make table backgrounds. I thought CSS only allowed you to change the top, bottom, left and right border? If this is true, then you can't really do customised corners? Or can you?

                    Comment

                    • Markus
                      Recognized Expert Expert
                      • Jun 2007
                      • 6092

                      #11
                      Originally posted by TheServant
                      I do use photoshop, but to make table backgrounds. I thought CSS only allowed you to change the top, bottom, left and right border? If this is true, then you can't really do customised corners? Or can you?
                      Yes you can.

                      markus

                      Comment

                      Working...