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

Case Analysis of CSS derived Selector

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

Share

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

Most people do not understand the knowledge points of this "CSS derivative selector case analysis" article, so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "CSS derivative selector case analysis" article.

In modern layouts, id selectors are often used to build derived selectors.

# sidebar p {

Font-style: italic

Text-align: right

Margin-top: 0.5em

}

The above style applies only to paragraphs that appear within elements where id is sidebar. This element is most likely a div or a table cell, although it may also be a table or other block-level element. It can even be an inline element, such as or, but this usage is illegal because it cannot be embedded in an inline element

(if you forget why, see XHTML: site refactoring).

One selector, multiple uses

This id selector can be used many times as a derived selector, even if the element marked as sidebar can appear only once in the document:

# sidebar p {

Font-style: italic

Text-align: right

Margin-top: 0.5em

}

# sidebar h3 {

Font-size: 1em

Font-weight: normal

Font-style: italic

Margin: 0

Line-height: 1.5

Text-align: right

}

Here, the p element in sidebar is treated differently from the other p elements on the page, and the h3 element in sidebar is also treated differently from all other h3 elements in the page.

The above is about the "CSS derived selector case analysis" of this article, I believe we all have a certain understanding, I hope the editor to share the content to help you, if you want to know more related knowledge, please follow the industry information channel.

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