Tuesday, March 24, 2009

CSS best practice

Inline style is not a good practice if you want to work with styles, as it is difficult to update if you want to make a modification across the site.

So, some WEB-UI developers start making a new framework to use while making their styles without using the inline style, they develop a class for each style, ex: .Width150px { width:150px;} and another one .Red {color:red;} and use it like this class=”Red Width150px”!
For me, using inline style is better as it will be much more faster while developing than using the above way.

The better practice for using CSS is by defining a meaning full name that describes the thing that will take the style, ex: .PageTitle {color:red; width:150px;} and give the DIV class=”PageTitle”, so I can update all the pages titles just by updating the CSS file, not going to each page title and update the class name.

No comments: