Home  >  Article  >  Development Tools  >  How to reference css in phpstorm

How to reference css in phpstorm

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-08-19 14:30:076323browse

How to reference css in phpstorm

4 ways to introduce CSS files

(1) Link type: in the 93f0f5c25f18dab9d176bd4f6de5d30e of the web page Use the 2cdf5bf648cf2f33323966d7f58a7f3f tag in the 9c3bca370b5104690d9ef395f2c5f8d1 tag to introduce external style sheet files, and use html rules to introduce external css (used more often):

<link href="./mystyle.css" rel="stylesheet" type="text/css"/>

Related recommendations: "PhpStorm use Tutorial

(2) Import type: Introduce an independent .css file into the HTML file. The import type uses CSS rules to introduce external CSS files. The c9ccee2e6ea535a969eb3f532ad9fe89 tag is also written in

<style type="text/css">
    @import"mystyle.css"; 此处要注意.css文件的路径
</style>

Comparison: The difference between link reference and import reference is: link is referenced before html is loaded, while import is referenced after html is loaded. For example, using import reference, the page without styles will be displayed first, and then the styles will be put in. If you use JavaScript to dynamically reference CSS, you must use the link reference method to achieve this.

(3) Inline css files, write css directly in the header, such as:

<style type="text/css">
div{margin: 0;padding: 0;border:1px red solid;}
</style>

This method is rarely used, and it is most commonly seen on portals with a large number of visits. website. Or the home page of a corporate website with a large number of visits. Compared with the first method, the advantages are outstanding and the disadvantages are also obvious. Advantages: fast, all CSS controls are for this page tag, there are no redundant CSS commands; and no external link CSS files are needed. Read styles directly in the HTML document. The disadvantage is that revision is more troublesome, a single page looks bloated, CSS cannot be referenced by other HTML, resulting in a relatively large amount of code, and maintenance is also troublesome. However, most companies that adopt this method have money. For them, the number of users is the key, and they have no shortage of people to perform complex maintenance work.

(4) Write the style directly in the tag

<div style="border:1px red solid;">测试信息</div>

The above is the detailed content of How to reference css in phpstorm. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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