The HTML5 document must be <! DOCTYPE html> Opening
definition language is English ) or ZH-CN (the definition language is Chinese )
If the browser follows the world standard, the lang attribute can be used to define the style, the class defines the main style, and the lang attribute can be modified on that basis.
Like what:
<style>
p{
Font-family: "The song Body"
font-size:14px;
Color: #F00;
}
P:lang (ZH-CN) {
Font-family: "The song Body"
}
P:lang (en-US) {
Font-family:arial
}
</style>
The main CSS for P tags here only defines the font size and color, and then you need to determine the font by the lang attribute of the tag.
The advantage of the lang attribute is that it's CSS inheritance, perhaps P tags need to define a lot of styles, but different languages (in fact, not just the language) may need to change a small number of styles, if you define these styles separately, it may be like CSS is lengthy, wasting the user's traffic and memory.Share to: