Get the App
SLTechnology News&Howtos  ›  Development  › 

How to insert CSS style in html

Shulou Source: shulou.com Published: 2022-06-02 01:06:45 09月25日 Update

This "how to insert CSS style in html" article, the article sample code is introduced in great detail, with a certain reference value, interested friends must refer to, for "how to insert CSS style in html", Xiaobian sorted out the following knowledge points, please follow the pace of the editor step by step slowly understand, then let us enter the topic.

1. Note:

(1) comments for .HTML:

(2) comments for .CSS: / * *

The method of inserting CSS (cascading style sheet) into 2.HTML

(1)。 Inline style (write style directly after the label)

Inline style

Methods for inserting css styles in html: 1 inline style, 2 internal style, 3 external style, 4 import style

(2) embedded (separate the style from html)

Inline style

P {text-decoration:underline;text-align:center;font-size:26px;font-family: Arial; font-weight:bolder;text-transform:lowercase;letter-spacing:4px;color:pink;background-color:green;}

The method of inserting CSS style into HTML:

1 inline style; 2 internal style

3 external style; 4 import style

3. External style (linked: separate CSS and HTML)! Most commonly used

First.html

Inline style

The method of inserting CSS style into HTML:

1 inline style; 2 internal style

3 external style; 4 import style

First.css

P {text-decoration:underline;/* underlined * /

Text-transform:lowercase;/* uppercase letters all lowercase * /

Text-align:center;/* centered * /

Font-size:23px;/* font size * /

Font-family: boldface; / * set font * /

Font-style:italic;/* setting word skew * /

Text-indent:3px;/* sets the first line indentation * /

Color:red;/* sets font color * /

Background-color:#ddd;/* sets the background color * /

Letter-spacing:4px;}

4. Guide type

First.html

Inline style

@ importurl (first.css)

The method of inserting CSS style into HTML:

1 inline style; 2 internal style

3 external style; 4 import style

First.css

P {text-decoration:underline;/* underlined * /

Text-transform:lowercase;/* uppercase letters all lowercase * /

Text-align:center;/* centered * /

Font-size:33px;/* font size * /

Font-family: boldface; / * set font * /

Font-style:italic;/* setting word skew * /

Text-indent:3px;/* sets the first line indentation * /

Color:red;/* sets font color * /

Background-color:#ddd;/* sets the background color * /

Letter-spacing:4px;}

What are the characteristics of html 1, simplicity: hypertext markup language version upgrade using superset mode, thus more flexible and convenient, suitable for beginner front-end developers to use. 2. Extensibility: the wide application of hypertext markup language brings the requirements of strengthening functions and increasing identifiers. Hypertext markup language adopts the way of subclass elements to ensure the expansion of the system. 3. Platform independence: hypertext markup language can be used on a wide range of platforms, which is one of the reasons why the World wide Web is so popular. 4. Versatility: HTML is the universal language of the network, which allows web producers to create complex pages that combine text and pictures, which can be viewed by anyone else on the Internet, no matter what type of computer or browser they are using.

The above is all the content of the article "how to insert CSS style in html". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Style font language text method tag color comment content uppercase uppercase size letter lowercase platform method knowledge background page boldface Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Microsoft Huawei Apple Shulou Tech Info