This article mainly shares with you a summary of four ways to introduce css. It has good reference value and I hope it will be helpful to everyone. Let’s follow the editor to take a look, I hope it can help everyone.
1. Inline reference: used directly on tags, but maintenance cost is high
style='font-size:16px;color:#000000'
2. External connection reference: css code is separated from html code, which facilitates code reuse
<link href="css/style.css" type="text/css" rel="stylesheet" />
The content of the style.css file is as shown on the right:
.font{color:blue;font-size:12px;}
3. Internal reference: The page is clearer, but cannot be used by other pages
<style type='text/css'> .font{color:blue;font-size:12px;} </style>
4. External import: Multiple stylesheets can be imported in one HTML file. Similar to the external link reference
, have you learned how to add
<style type='text/css'> @import url('./style/style.css'); </style>
to the head tag in the HTML file? Collect it if you find it useful.
Related recommendations:
Using css style nesting method in Dreamweaver web page production
What should you pay attention to when setting table CSS style
Use CSS styles to generate search, shopping cart and other icon styles
The above is the detailed content of Summary of four ways to introduce css. For more information, please follow other related articles on the PHP Chinese website!