"; 2. Reference css through internal style sheets, code such as " "; 3. Reference css through external style sheets."/> "; 2. Reference css through internal style sheets, code such as " "; 3. Reference css through external style sheets.">

Home>Article>Web Front-end> How to reference css in html

How to reference css in html

藏色散人
藏色散人 Original
2021-04-28 10:43:49 16732browse

How to reference css in html: 1. Reference css through inline style, code such as "f02c9131b3fdffdb2d7d89776890f28d"; 2. Reference css through internal style sheet, code such as " 080b747a20f9163200dd0a7d304ba388..531ac245ce3e4fe3d50054a55f265927"; 3. Reference css through an external style sheet.

How to reference css in html

The operating environment of this article: windows7 system, HTML5&&CSS3 version, DELL G3 computer.

Three ways to reference css in html

CSS was first used in HTML 4 and was introduced to better render HTML elements.

CSS is introduced into HTML in the following three ways: 1-inline, 2-internal style sheet, 3-external style sheet.

  • Inline style:


      

Within the tag style=" "

  • Internal style Table:

Use the style tag and place the attributes to be controlled by CSS inside the tag

  • External style sheet:

In the head tag, and use the link tag to introduce the css file you want to load

I accidentally discovered that when I use these three expression methods to control the background-color attribute at the same time When , only the properties within the tag of the inline style take effect.

Inline tags set the background color to gray, internal style sheets are set to red, and external style sheets are not set. The background color on html is gray.

The background color of the inline tag is set to gray, the external style sheet is set to yellow, and the internal style sheet is not set. The background color on html is gray.

Internal style sheets are set to red, and external style sheets are set to yellow. The background color on html is yellow.

Conclusion: Inline>External Style Sheet>Internal Style Sheet

It can be seen that the attributes closest to the label are reflected first.

For more detailed HTML/css knowledge, please visit theHTML video tutorialcolumn!

The above is the detailed content of How to reference css in html. 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:What technology is html5 Next article:What technology is html5