Home >Web Front-end >CSS Tutorial >Various ways of writing css

Various ways of writing css

php中世界最好的语言
php中世界最好的语言Original
2018-03-22 17:36:322272browse

This time I will bring you various ways of writing css. What are the precautions for writing css? The following is a practical case, let’s take a look.

Priority: External style < Internal style sheet < Inline style sheet;

Priority, that is: the right side of the selector with the same name will overwrite the left side

1. Internal style sheet

CSS CodeCopy content to clipboard

  1. ##                                                                                                                                                                                            

  2. ##Headtip {

  3. ##: 0xFF5;
  4. ##}

  5. 2. Use the link tag , the most common way to declare the use of external resources in the document.
  6. @CHARSET="utf-8"; that specifies the encoding of the css external style sheet needs to be placed on the first line.

    XML/HTML CodeCopy content to clipboard

    1. ##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 Flashing. Not recommended.
    2. CSS Code
    3. Copy content to clipboard

    ##

  7. 4. Inline style sheets have the highest priority and are the most straightforward, but they cannot be reused. Easy to maintain.
  8. XML/HTML Code
  9. Copy content to clipboard

:30px;"/>

##< /body>
  1. I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
  2. Recommended reading:

    Three ways to horizontally and vertically center absolutely positioned elements

  3. Waterfall flow layout and infinite loading Picture album effect

The above is the detailed content of Various ways of writing css. 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
Previous article:Use of not() selectorNext article:Use of not() selector