" tag at the head of the html file; 3. Through the "" tag Introduce external CSS style files."/> " tag at the head of the html file; 3. Through the "" tag Introduce external CSS style files.">

Home>Article>Web Front-end> What are the three ways to implement css in html?

What are the three ways to implement css in html?

醉折花枝作酒筹
醉折花枝作酒筹 Original
2021-04-07 11:26:02 7063browse

Three implementation methods: 1. Use the style attribute in the html tag to define the css style; 2. Write the css style in the "c9ccee2e6ea535a969eb3f532ad9fe89531ac245ce3e4fe3d50054a55f265927" tag in the header of the html file; 3. , introduce external CSS style files through the "2cdf5bf648cf2f33323966d7f58a7f3f" tag.

What are the three ways to implement css in html?

The operating environment of this tutorial: Windows7 system, CSS3&&HTML5 version, Dell G3 computer.

CSS styles are referenced in 3 ways. They are defined inline, linked to internal CSS and linked to external CSS.

1. Inline definition

Inline definition, that is, using the object's style attribute within the object's tag to define the applicable style sheet attributes. The format is defined as:98d90bba3abb2065dcfbefbeb05fc04e94b3e26ee717c64999d7867364b1b4a3, the following example


The browser displays the content at this time


2. Link to internal CSS

The link within CSS is made byc9ccee2e6ea535a969eb3f532ad9fe89531ac245ce3e4fe3d50054a55f265927 Thetag pair is placed in93f0f5c25f18dab9d176bd4f6de5d30e9c3bca370b5104690d9ef395f2c5f8d1. There is a type attribute type in c9ccee2e6ea535a969eb3f532ad9fe89, followed by test/css, which represents CSS text. The syntax format is as follows:

The example is as follows:

The rendering is as follows:


3. Link external CSS

css external link is to place the CSS file outside the web page, and make the CSS file effective for the style of this web page through the link 2cdf5bf648cf2f33323966d7f58a7f3f, which is equivalent toin C language .hfile. The attributes in

2cdf5bf648cf2f33323966d7f58a7f3f include type, rel, and href, where type is fixed totext/css, and rel (ie, style sheet) is fixed tostylesheet. href naturally refers to the address of the css file. The syntax format is:

The sample code is as follows:

The content of web.css is

The effect is as follows


Learning video sharing:css video tutorial

The above is the detailed content of What are the three ways to implement 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