CSS external references use external CSS files, the general browser with caching, so users do not have to download this CSS file every time.
External references are efficient for both internal and inline references to save bandwidth.
External references are recommended for use by the consortium.
External referencing CSS is the best way to introduce CSS (you can minimize the amount of code, the most consistent performance is recommended for standard web design. Inline references (used directly in HTML tags) are a quick way (in addition to cascading, I'll introduce cascading in advanced tutorials), But it is not conducive to the future unification of the changes and performance of consistency, so do not advocate the use.
Referencing CSS using the link label
Example
CSS Code copy content to clipboard
-
- <link rel= "stylesheet" type=" text/css" href= "Http://www.dreamdu.com/style.css"/>
-
Referencing CSS using @import
Example
CSS Code copy content to clipboard
-
- <style type="Text/css"> @import URL(http://www.dreamdu.com/style.css);</style>
-
Relative path and absolute path
You can use a relative or absolute path when loading a file
Absolute path: The full path to the file, the file or directory on the home page, the true path on the hard disk
Http://www.dreamdu.com/html/default.html is absolute path,/html/default.html is also absolute path, C:winntsystem.sys is also absolute path
Relative path: View the path to the document in relation to US
.. /default.html or default.html or. /.. /default.html are all relative paths