Here's a list of simple and practical ways to help you improve your CSS stylesheets, and if you're just starting to use CSS, this log will help you better understand CSS.
Here's a list of simple and practical ways to help you improve your CSS stylesheets, and if you're just starting to use CSS, this log will help you better understand CSS.
#1. Structure
Keep the CSS structure clear, not only help to keep the CSS file simple, but also conducive to future inspection, change.
#2. Keep it simple
Keeping your code simple can drastically reduce the size of your CSS file.
#3. Padding vs. Margin
For browsers,Margin is one of the worst compatibility attributes. Therefore, you should use the Padding property as much as possible if the conditions permit.
#4. Integration
In the following example, a common class is defined to replace the same code that is used in different places:Color:grey.
#5. Comments
Adding a simple annotation in the right place will not only help you understand the code, but others will also be able to understand your code well.
#6. Verify
It's a good idea to validate a CSS file that has already been created to help you find errors in your files. The Consortium CSS Authentication Service
#7. Avoid using styles in XHTML
Do not use styles in XHTML code, which not only increases the size of your Web page files, but also makes your code confusing and complex.
#8. Named
Use a standard ID and class name that you can literally understand correctly, not just code names.