Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The three basic elements of CSS

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces "the three elements of the basic composition of CSS". In daily operation, I believe that many people have doubts about the three elements of the basic composition of CSS. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the questions of "the three elements of the basic composition of CSS"! Next, please follow the editor to study!

Basic CSS syntax-selectors, attributes, and values

The basic syntax of CSS is simple and mainly consists of three elements, namely, selector, attribute, and value.

Selector

The selector is the name given to the internal or external stylesheet. The selector can be a HTML tag, an element ID defined in HTML, or a CLASS name defined by HTML. The selector is the basic unit of a CSS.

Attribute

Each selector has an properties in curly braces {}, including words such as color, font-weighth, or background-color.

Value (value)

CSS median in half-corner English quotation marks: followed by half-corner English semicolon; isolation.

Sample code

Body {font-size:0.8em;color:navy;}

As above, this assigns values to the font-size and color attributes in the body selector.

Basically, if this applies to HTML documents, the text between the body tags (the contents of the entire window) will be 0.8em-sized and appear dark blue.

Length and percentage

There are many proprietary attribute units in CSS, as well as many regular units that can be used for a large number of attributes, which are worth familiarizing yourself with before you move on.

An em (such as font-size:2em) is a unit roughly the same height as a character.

Px (font-size:12px) is a unit of pixels.

Pt (font-size:12pt) is a unit of pounds.

% (font-size:80%) is a... Units, etc. Oh, it's a percentage.

Other units include pc (movable type), cm (centimeters), mm (millimeters) and in (inches).

You don't have to declare a unit for a value of 0. For example, if you don't want a boundary, you can set it like this: border:0.

At this point, the study on the "three basic elements of CSS" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report