#1. Structure
Keeping the CSS structure clear not only helps to keep the CSS file simple, but also facilitates future checks and changes.
#2. Keep it concise
PersistenceCodeIt is concise and can greatly reduce the size of CSS files.
#3. Padding vs. Margin
For browsers, margin is the most compatible attribute. Therefore, the padding attribute should be used whenever possible as long as conditions permit.
#4. Integration
In the following example, a public class is defined to replace the same code used in different places: Color: Gray.
#5. Notes
Adding a simple comment at a proper position not only helps you understand the code, but also helps others understand your code.
#6. Verify
It is best to verify the created CSS file to help you find the errors in the file.
#7. Avoid using styles in XHTML
Do not use styles in XHTML code. This not only increases the size of webpage files, but also makes the code messy and complex.
#8. Name
Use standard IDs and class names that can be understood literally, not just code names.