HTML Coding Rules : Rule 4

CSS


< link rel="stylesheet" type="text/css" href="all.css" />
< style type="text/css">@import “noNav4.css”;< /style>

The browser was created before the rise of CSS. What does this mean? Well, it means that old browsers won’t understand your CSS files. In fact some browsers, sorry I mean Netscape 4, will crash at the sight of CSS.

The first line will work for all browsers. Just keep in mind only CSS level 1 should be in this file. But on the second line, Netscape will ignore it because it does not understand the @import tag.

The idea is to build on top of your CSS code so all browser will render correctly.

But in reality, if you look at the browser statistics, you should be mainly concern with MSIE 6/7, Mozilla/Firefox, and Safari. Part of me still loves Opera, but it’s dead last on my list when I’m coding HTML.

All browsers have default settings and that’s the reason why MSIE and Mozilla renders each page differently. So in your CSS file, just reset the default settings and you’ll have consistency throughout each browser. Add this line to the top of you CSS file:


html, body, ul, ol, li, p,
h1, h2, h3, h4, h5, h6,
form, fieldset, a { margin:0; padding:0; border:0; }

via [HTMLTree]

Comments are closed.

Bad Behavior has blocked 50 access attempts in the last 7 days.