Home > Web Front-end > CSS Tutorial > Summary of four ways to introduce css

Summary of four ways to introduce css

小云云
Release: 2018-01-08 10:38:53
Original
2161 people have browsed it

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'
Copy after login

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" />
Copy after login

The content of the style.css file is as shown on the right:

.font{color:blue;font-size:12px;}
Copy after login

3. Internal reference: The page is clearer, but cannot be used by other pages

<style type=&#39;text/css&#39;>
    .font{color:blue;font-size:12px;}
</style>
Copy after login

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=&#39;text/css&#39;>
    @import url('./style/style.css');
</style>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template