Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the three ways to introduce css?

Shulou Source: shulou.com Published: 2022-06-01 06:12:59 10月02日 Update

This article mainly introduces the relevant knowledge of "what are the three ways to introduce css". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "what are the three ways to introduce css" can help you solve the problem.

There are three ways to introduce css

1. Row introduction is a preferred way to html, but it has great limitations. It works in the label. Eg:+ action object +

.

2. Internal introduction, tag selector, ID selector and class selector are all internal introduction, that is to say, three ways of internal introduction.

In the tag selector eg:css, p {color:red;}

Id selector eg: in html, in css, it is, # A word {color:red;}

# A sentence {color:blue;}

The class selector was mentioned above.

3. External introduction

The format is

This kind of introduction lacks example practice.

Css Common Properties

Width: sets the width of an element

Height: sets the height of an element

Text attribute

Font-size: sets the size of the text to be numeric, in pixels (commonly used)

Color: set the color of the text to either the English name of the color or the hexadecimal value

Font-weight: set font bold value 100,900 bold (common value) normal (default)

Font-style: set font tilt value normal (normal): default italic: set text tilt

Font-family: set font style value is font name normally set font must be installed on the computer

Text-decoration: set the text decoration as follows

None: the default value has no decorative effect

Underline: setting underline

Overline: setting overline

Line-through: setting delete line

Text-align: sets the location of the text left (default), center, right

Line-height: sets the line height of the text. The text is centered vertically based on the line height. Without setting the line height, the default line height is 1.2 times the font size.

Text-indent: set text indentation value in em. 1em is exactly equal to the width of 1 Chinese character.

Label classification

1. Inline tags: do not occupy a single line, but cannot set width and height

Inline tags: a, text labels, span, etc.

2. Block-level tags: occupy a single line, but can set width and height

Block-level tags: h class tags, p, list class tags, tables, etc.

Img: both in-line and block-level (that is, width and height can be set on one line)

Conversion between inline elements and block-level elements:

Convert to each other through display attributes

1. Inline conversion to block level: display:block

2. Convert block level to inline: display:inline

3. Convert to both inline and block level: display:inline-block

4. Display:none sets the current element to hide

This is the end of the introduction of "what are the three ways to introduce css". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Tags: Label text way font selection element line attribute commonly used knowledge function unit size width that is case industry color different practical Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi vpn Shulou Technology Docker OPPO Reno