Friday, July 10, 2009

Few Guidelines while writing CSS

1. Defining font sizes in css:
While defining font sizes in stylesheets , we should hardcode the same only once. This will make font size manipulation easier. If we want different font sizes for various child elements of an HTML element we should use relative values (like em , %) . It is because a child element of an HTML element assumes its parent element's font size as its default value , thus inheriting the value thereby. But the most possible exception for this statement is IFRAME element in HTML

2. Reducing lines in a css file:
If we have number of same properties having same value. We should avoid repetition of the same by declaring that specific rules at a time and as usual separated by commas. By doing so we can make our css file compact.

No comments: