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

What are the forms of css selectors

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

Share

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

This article mainly introduces "what are the forms of css selector". In daily operation, I believe many people have doubts about the form of css selector. The editor consulted all kinds of data and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the question of "what is the form of css selector?" Next, please follow the editor to study!

When we define a style rule, this style rule acts on certain elements of a web page, and our rules for these elements are called selectors.

1.id selector

two。 Class selector

3. Tag selector

4. Cross selector

5. Group selector

6. Descendant selector (including selector)-parents and children are separated by spaces

7. Universal selector: * {}

Css selector

Pseudo class selector

Different styles of the same html element in different states

A:visited {color: # 00FF00} / * visited links * /

A:hover {color: # FF00FF} / * move the mouse over the link * /

Inheritance and superposition of css

1. Inheritance

Descendant elements inherit some text attributes and styles of their predecessors.

two。 Superposition

The same element is specified by multiple style rules.

Because of the inheritance and superposition of css, there is the concept of css priority.

Priority of selector

Css comment

Annotation

There are comments in any language, and CSS is no exception.

The comment of CSS is / * comment content * /

Block elements and inline elements

We have learned a lot about HTML tags. Different tags have different features. For example, from the point of view of document flow, tag elements are divided into block tags and line tags.

A block tag, that is, a tag element is a block, that is, it has wide and high attributes. At the same time, the block tag will occupy a single line. For example, H1~H6, P, li and other tags are all block tags. Of course, they also include the DIV tag we are about to learn.

The row label is just the opposite of the block label, the row label does not have wide or high properties, and the value of the mrgin attribute is only left and right. It will not occupy a line, so we can use line labels to specify different CSS styles for text blocks to achieve different results, and there are many line labels, such as em, span tags and so on.

At this point, the study of "what are the forms of css selectors" 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