0% found this document useful (0 votes)
4 views1 page

CSS Rules Quick Guide

This quick guide outlines best practices for writing CSS, including using lowercase for selectors, ending declarations with semicolons, and avoiding inline styles. It emphasizes the importance of organization, consistency, and responsiveness in CSS coding. Additionally, it suggests using class selectors, CSS variables, and validating code for optimal performance.

Uploaded by

yassinbh1999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

CSS Rules Quick Guide

This quick guide outlines best practices for writing CSS, including using lowercase for selectors, ending declarations with semicolons, and avoiding inline styles. It emphasizes the importance of organization, consistency, and responsiveness in CSS coding. Additionally, it suggests using class selectors, CSS variables, and validating code for optimal performance.

Uploaded by

yassinbh1999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

SQL Rules - Quick Guide

- Use lowercase for all selectors and properties.

- Always end each declaration with a semicolon (;).

- Use external stylesheets whenever possible.

- Avoid inline styles in HTML.

- Group related CSS rules together.

- Use shorthand properties (e.g., margin: 10px 5px;).

- Use consistent indentation (2 or 4 spaces).

- Add space after colons in declarations (e.g., color: red;).

- Use class selectors instead of ID selectors for reuse.

- Name classes with meaningful, readable names (e.g., .btn-primary).

- Avoid using !important use it only as a last resort.

- Use comments (/* */) to explain sections of code.

- Organize CSS from general to specific (reset > layout > modules).

- Use a CSS reset or normalize.css for consistency across browsers.

- Test responsiveness with media queries.

- Use rem/em units for scalable sizing instead of px.

- Avoid deeply nested selectors.

- Keep selectors short and efficient.

- Use CSS variables for consistent theming.

- Validate your CSS with a validator.

Page 1

You might also like