20. February 2007 21:05
As most of us would know, HTML is the most basic you can get when you program for web. If your HTML is not right then your page will not look right. Each browser renders HTML differently, especially when it's malformed. Internet Explorer is the most forgiven of them all, but the other browser are less or not forgiven at all. Ok, what do we do about it? You can do a number of things.
The first and most important one; learn HTML and learn it the right way. There are a number of tutorials on the web.
Then you need to get a report of the browser used by your visitors. There are many browsers out there and it is almost impossible to have your page look exactly the same on all browsers. If you look at your page statistics then you know which browsers to target. Most likely your number one browser will be IE and your second one will be Firefox. The good news is that Firefox and IE render the pages very similar, but not exactly the same. Most likely you will have 10 different browsers on your statistics and it will be impossible to tackle them all. Code your pages for the most used browser (you have to draw the line somewhere.)
This one goes hand in hand with the previous point. If you're developing an intranet application then most likely you will only have to target one browser and that browser will most likely be IE or Firefox. That doesn't mean you should accept poorly written HTML just because IE is forgiven. You never know what direction the future will take and there's a possibility of the company switching browsers or a future update of the browser not being backward compatible with some elements. As a matter of fact there are specific CSS elements supported on IE 6 that are no longer supported on IE 7.
Test your application on all supported browsers. Yes, test them and make sure they look as you want. Sometimes it will not look the same and the time and energy needed to make them look exactly the same on all supported browsers will not compensate with the end result. So make sure your number one browser looks like it is supposed to look and your other browsers look OK or better.
Let the user know what browser you support. This one is important. I used to work for a company where I had to take care of everything: programming, admin, and even tech support. We would get calls from people complaining some features will not work. When they would tell me they were using IE 3 or Netscape 4.1 (at that time IE was on version 6 and Netscape on version 8, I think) I would kindly tell them to update their browsers as we did not support prehistoric ones. We had a statement on the Agreement explaining which browsers were supported.
Don't tell your users to use a specific browser. That is not user friendly and you will probably loose customers/clients. I've seen so many websites where they tell you that only one browser is supported and they even give you a link to download the browser. When that happens to me I just don't use their website. Like I said before, you have to draw the line somewhere and these websites draw it way ahead. One supported browser usually is not good (Intranet apps are the exception)
I hope this helps to a lot of people out there. Stay tuned for the second part where I will demonstrate some bad HTML.
As always, happy programming!