: If CSS is getting better why do big-brands websites still use tables for layout? Everybody is referring to how content should be separated from layout and I am one strong advocate of that architecture,
Everybody is referring to how content should be separated from layout and I am one strong advocate of that architecture, I find it easy too to use CSS to layout, much much easier than tables,
But why oh why, do big names still use tables for layout? (Google Shopping is the biggest offender), eBay, Amazon, BaseCamp... great websites wouldn't you agree? I just need to understand their motives, so that I know for sure: am I missing something? is it really easier or faster or cheaper to use tables?
Google shopping code snippet:
More posts by @Phylliss660
8 Comments
Sorted by latest first Latest Oldest Best
Perhaps also because they know that next standard, HTML5, accepts (though does not encourage) the use of tables for layout, q.v:
If a table is to be used for layout it must be marked with the
attribute role="presentation" for a user agent to properly represent
the table to an assistive technology and to properly convey the intent
of the author to tools that wish to extract tabular data from the
document. There are a variety of alternatives to using HTML tables for
layout, primarily using CSS positioning and the CSS table model. The
border attribute may be specified on a table element to explicitly
indicate that the table element is not being used for layout purposes.
If specified, the attribute's value must either be the empty string or
the value "1". The attribute is used by certain user agents as an
indication that borders should be drawn around cells of the table.
www.w3.org/TR/html5/tabular-data.html#the-table-element
Sometimes use table layout can decrease the complexity of the code, because the CSS counterpart is less intuitive.
Too often I add a CSS rule to achieve one goal, but this rule often will have side-effects which you then need to fix. It is because the rule was not designed to solve my problem, and I am the one using its side-effect to solve the problem.
And often I added a lot of margins/paddings/floats/overflows rules to achieve my layout, but after a month I really couldn't tell which set of rules are for this layout goal. There is no standard way to achieve one layout, so if I pass my code to the next person they can only tweak it but never fully understand all the side-effects.
Take the most common 'Equal Height Column' layout for example, there are many ways of doing it. One requires 2 layers of wrappers, and a better solution is no less counter-intuitive. What about needing a sticky footer? Just wrap the header and content again! Pretty soon you will find your design to be rigid and unmodifiable.
Don't get me wrong, I hate to see table as the top container. I just want to point out that CSS can get as ugly as tables from time to time. So it is up to the developer to decide which will be more effective at the end of day.
If I were banned from using tables, I would probably emulate them with CSS. They are so natural. A few years ago I would blindly accept all that preaching about the evil of table layout - now I'm choosing what's more convenient. Plus in ASP.NET we have nice table control class. BTW I'm also using table layout in desktop apps (XAML WPF) - I haven't heard any suggestions to deprecate tables there.
This has been on SO: stackoverflow.com/questions/83073/why-not-use-tables-for-layout-in-html
I started coding in 1996. Obviously, I became and expert at coding tables quickly. Tables are quick and easy and really consistent when combined with CSS.
Creating a layout using only CSS or only tables because you think it's the right thing to do, is foolish.
"The right thing to do" is usually a combination of things, including your coding skill level, potential lifespan of the site, other coders, and the technology of your users.
If you have 8 hours to spend on a project and it will take 7 hours to develop using only CSS (for layout) or 2 hours using only tables time (for layout), you'd have only a limited time for anything else, like content or SEO.
Just try to develop something that is fairly easy to maintain, fairly easy to learn, and works just the way you want it to most of the time. Anything other than that is a total waste of time.
Building websites using HTML & CSS is not an easy task. Issues such as Cross Browser Compatibility, fixed/fluid layouts, floating nature of elements etc are general problems which web designer's often come across. To keep the layouts intact, and to render elements at a perfect place, web designers often make use of tables. More over, you can use 100% width for your website content, perfect placement for your elements, which will be resolution free, where as using CSS, often web designers stick to fixed layouts or make use of JavaScripts.
For more detailed info: Click Here
tables are not as flexible as CSS if you need to change the layout later on, but many times they take less effort than attempting to render the same things in CSS using tons of CSS hacks to make all browsers render the same or almost the same (for instance IE).
Possible reasons:
They're using the lowest common denominator web browser. In other words, they're trying to render reasonably well in older browsers. Because these sites get huge amounts of traffic even a browser with .1% of the browser market can add up to a significant number of users. So in an attempt to support those users they shy away from more modern markup and use markup still supported by those browsers.
The code is old and has not been updated. This can be because of cost issues or logistically issues.
They don't want to. Their sites are obviously well trafficked with their current code so they see no reason to change any of it.
It some designs, it is very difficult to correctly align content between each others in css, especially 3 columns setup mixed with vertical alignment (like in your example).
Tables provide a rock solid compatibility between browsers, desktop, mobiles, etc ..
Another reason is ... mail clients. A cut and paste from a web browser can render very bad in a mail client, officle client, etc ..
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.