Briefly describe the four ways of writing css

巴扎黑
Release: 2017-03-14 11:55:05
Original
2552 people have browsed it

##Priority: External style < Internal style sheet < Inline style sheet;
Priority, that is: the right side of the selector with the same name will Override the left side


1. Internal style sheet

<head>    

        <style>    

            /*内部样式表,一般用于覆盖公用样式*/   

            #headTip {    

                color: 0xff5;    

             }    

        </style>    

    </head>
Copy after login



2. Use the link tag in the document Declaring the use of external resources is the most common way.
The @CHAR
SET="utf-8"; that specifies the encoding of the css external style sheet needs to be placed on the first line.

<head>   

        <link href="./my-common.css" rel="stylesheet" media="screen" type="text/css"/>   

    </head>
Copy after login



3.@ method, introduce css. Note that this is loaded asynchronously. It is loaded after the entire html is loaded, which will cause the page to flicker. Not recommended.

<head>    

        <style>    

            @import &#39;my-common.css&#39;;    

        </style>    

    </head>
Copy after login



4. Inline style sheets have the highest priority and are the most straightforward, but they cannot be reused and are not easy to maintain.

<body>   

        <input type="text" style="color:0x550;font-size:30px;"/>   

    </body>
Copy after login


The above is the editor’s brief discussion on the four writing methods of CSS (a must-read article). I hope everyone Duoduo supports Script House~

The above is the detailed content of Briefly describe the four ways of writing css. For more information, please follow other related articles on the PHP Chinese website!

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!