Advantages of div css embedding and layout
1. Embedding method
Inline applicationYou can declare the style directly in the HTML file.
For example, Thisisfontsize16. The above HTML file will appear on the browser as: Thisisfontsize16. Embedded application styles can be embedded in HTML files (usually in the
). For example, the background color is red< /body> The above HTML will appear: the background color is redExternal link application
In this way, all CSS style declarations are stored in another file. The file is usually named .css. In the
The above line will add the styles declared in the external-stylesheet.css file to the HTML file.
Import ApplicationExternal CSS styles can also be imported into HTML files. The way to import is to use the @import command.
The syntax of @import is:
The original purpose of the @import directive was to use different styles for different browsers. However, this is no longer necessary. The most common purpose of using @import today is to add multiple CSS styles. When multiple CSS styles are added via @import and different CSS styles conflict with each other, the CSS styles added later have priority (see CSS concatenation for details).
There is also a way to embed directly on the tag, but this writing method has some limitations. Most tags can accept this solution: