Posts

Showing posts with the label css best practice

css best practice

Avoid using inline styles in page. Declare your most generic items first, then the not-so-generic and so on. Organize the Stylesheet with a Top-down Structure If you don’t have to reference specific object, it is strongly recommended to use class instead of id selectors Use Useful Naming Conventions: Use lowercase characters to define your class. Use always presentational naming example. When assigning a class or id, ask yourself “What is this element for? Avoid using names that rely on location CSS Shorthand makes development much easier and keeps your CSS clean, short & accessible. Use Multiple Classes Avoid Extra Selectors Optimize CSS code creating only the main classes and reusing HTML standard tags for child elements If layout is not so complex in order to justify multiple files then it is better to have one large css file rather than multiple small files because that way you reduce http requests. Giving precise and clear class names to your elements is a k...