What are the three ways to implement css in html?

醉折花枝作酒筹
Release: 2023-01-04 09:34:45
Original
7156 people have browsed it

Three implementation methods: 1. Use the style attribute in the html tag to define the css style; 2. Write the css style in the "" tag in the header of the html file; 3. , introduce external CSS style files through the "" 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: <p style="content"></p>, the following example


The browser displays the content at this time


2. Link to internal CSS

The link within CSS is made by <style></style> The tag pair is placed in <head></head>. There is a type attribute type in