"People rarely read the full CSS specification first, and these specifications can send anyone to sleep." ”
"One of the best ways to learn CSS is to start using it directly. ”
"First saw some great results from the blog, so look at the source code to see how they are implemented, and then on their own personal site is a bold attempt." ”
First, from the beginning should pay attention to the basic problems, develop good habits:
1. Good document structure
Don't rely too much on the visual editor; Bad code structure might make you prefer to write pages from scratch rather than look for bugs;
2. Meaningful marking
The semantic tags currently available in HTML 4 are not exhaustive, at least without elements that can be directly used like headers, navigation, footer, and suboptimal solutions that use existing elements and give them additional meaning by adding IDs or class names. For example, make a navigation bar: <ul id= "NAV" >.
3. Easy to understand and maintain
Second, ID and class
Bottom line: The ID is unique and the class is similar .
"Andy-budd is much clearer than Andybudd. ”
1. When naming IDs and classes, be sure to be independent of how they behave.
Poor naming (how it looks): Red,leftcolumn,topnav,firstpara ...
Good name (what it is): Error,secondarycontent,mainnav,intro ...
2. The naming of IDs and classes is case-sensitive, using uniform conventions according to personal habits or requirements.
Mastering CSS: Advanced Web Standard Solution (2nd Edition)--Chapter One basics