Home > Article > Web Front-end > A beginner's introduction to CSS: multiple declarations of style
Sub-item statement
After understanding the basic statement and the overall statement, now let’s talk about the sub-item statement. Basically, there is no need to say more about this content, because there is no special usage. Just look at the following example:
body{font-size:9pt; font-color:red}
body{font-family:宋体; background:white}
You will find that we made two statements on the label at the same time, yes! This is the sub-declaration we are going to talk about today, that is to say, we can make two different declarations for the same tag. In CSS, this is okay! As for whether this is unnecessary? Or more flexible? That depends on your usage habits! Basically, everyone’s CSS writing habits are different.
Be careful of the following situations:
In the sub-declaration, there are situations that you need to pay special attention to, as follows:
body{font-size:9pt; font- color:red}
body{font-family:宋体; font-color:blue}
You discovered the red part! If you make a sub-declaration on the same tag, the style attributes in it will be the same (the font-color attributes are the same, but the setting values are different). So what will be the result? Text enclosed by labels is displayed in blue. Everyone can try it!
The above is the basic introduction to CSS: the content of multiple declarations of styles. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!