Subscribe to Sergio Tapia - Lost in the GC.        RSS Feed
-----

HackerNews - Now without Table or Center elements!

Icon 1 Comments
I kid, I kid.

Last week I posted a thread on HackerNews asking why the website used tables for layout. I even noticed they were using the <center> tag.

http://news.ycombina...item?id=4370206

It seemed so strange to me that a website that is so cutting edge for developers would use web constructs plucked right out of a geocities website.

All HN needed now was some spinning skull GIF's and it was Angelfire City.

This morning was a slow day at work so instead of walking around the office I decided to rewrite the Hacker News website using HTML and CSS - the right way. (Or so I tried! - If I screwed up let me know!)

http://jsbin.com/ewufof/3/edit

The reason behind this was a commenter in the original HN thread that asked what the point was behind not using tables. "Tables just make it look right and is easier to position." The age old argument. Granted, he said he wasn't a web developer; he was a more down to the metal developer, wrestling with C on embedded systems.

Since he (and so many others) are all about the numbers, how's this for a number:

Original HN website: 26087 characters long.
My rewrite: 3587 characters long.

That is some massive savings. This will not only be lighter down the wire, but the browser will render it faster because it has less to do.

And it can be made even shorter with some more advanced wizardry.

The point I'm trying to make is that using <table> elements for layout is bad and you should feel bad for using them. If you tried modifying something in original HN it would take a long time.

In my example, just change some CSS rule and it'll ripple to all that apply.

Do you think you can make it any shorter?

1 Comments On This Entry

Page 1 of 1

Martyr2 Icon

13 August 2012 - 09:36 AM
Eh... normally I would agree if browsers around the world would agree to follow the CSS standard. Not until recently have all the browsers pretty much gotten on the same page about CSS. Even as little as a year and a half ago most browsers couldn't agree much on CSS and I would have argued that limited table use for layout was acceptable.

The way things are moving now I would imagine no one needing to use tables for layout in the next year or so. But in the time being I would let some websites slide... especially if they are large and would require a lot of resources to convert.

:)
0
Page 1 of 1

Trackbacks for this entry [ Trackback URL ]

There are no Trackbacks for this entry

2 user(s) viewing

2 Guests
0 member(s)
0 anonymous member(s)

About Me

Posted Image


Bienvenidos! I'm a USA ex-pat living in Bolivia for the past 10 years. Web development is my forte with a heavy lean for usability and optimization. I'm fluent in both English and Spanish. I guest write for the popular Python website Python Central. Visit my website.

Categories