Wednesday, October 6, 2010

CSS Do's and Dont's Part 1

1. Crossbrowser check
Check the layout in major browsers like Firefox, IE, IE6. Different browsers will give different interpretations to the same code. Make sure the appearance is exactly the same as planned for all browsers. If it doesn't, try to fix it. From experience, IE6 will usually having problem in appearance. Till now found that, IE6 can't display png file and hover effect. Javascript is needed to solve this.

2.Use Class and ID's appropriately
Try not to create redundant classes and ID's.According to the article, new beginners tend to create class and ID's for every single element. End up, it is messy and redundant. take note of this.Plan well and make it easy.

3.Keep style clean in stylesheet
Try not to put style inside the markup,that means try not to put in style setting in HTML code. Let all the style adjusting be set in CSS file.Only classes and ID's name appear in HTML code.

4.Learn tricks and limit hacks
Mostly on common bugs and fixes.Do check the reference page for more articles.

5.Optimise the CSS code
Make the code simple and try to reduce it's complexity and "weight"

6.Learn how to use absolute positioning
Mostly we use the combination of float and block element to create layout. Use only absolute positioning when necessary.

Reference:

No comments:

Post a Comment