Back to Tools
CSS Formatting Guidelines
Indentation
- Use consistent indentation (2 or 4 spaces)
- Indent properties within selectors
- Align related properties
- Use tabs or spaces consistently
Selector Formatting
- One selector per line for multiple selectors
- Space before opening brace
- Closing brace on new line
- Use meaningful class names
Property Formatting
- One property per line
- Space after colon
- Semicolon after each property
- Use shorthand when possible
CSS Tools & Tips
Minification
Reduce file size by removing whitespace and comments for production use.
Validation
Validate CSS syntax to catch errors and ensure cross-browser compatibility.
Responsive Design
Use media queries and flexible layouts for different screen sizes.
Organization
Group related styles, use comments, and follow a consistent naming convention.