In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how HTML puts a class attribute on each em element found in H1". In daily operation, it is believed that many people have doubts about how HTML put a class attribute on each em element found in H1. The editor consulted all kinds of materials and sorted out simple and useful operation methods. I hope it will be helpful to answer the question of "how can HTML put a class attribute on each em element found in H1"! Next, please follow the editor to study!
Each em element found in H2 has a class attribute on it, but obviously the descendant selector is more efficient.
Grammatical interpretation
In the descendant selector, one end of the selector on the left side of the rule includes two or more selectors separated by spaces. The space between selectors is a combinator. Each space combination can be interpreted as ". In" find ",". As part of ", as. Descendants of", but requires that the selector must be read from right to left.
Therefore, the H2 em selector can be interpreted as "any em element that is descended from the H2 element". If you want to read the selector from left to right, you can replace it with the following phrase: "all H2 containing em will apply the following style to the em."
Specific application
The descendant selector is extremely powerful. With it, you can make tasks that are impossible in HTML possible.
Suppose you have a document with a sidebar and a main area. The background of the sidebar is blue and the background of the main area is white, both of which contain a list of links. You cannot set all links to blue because the blue links in the sidebar are not visible.
The solution is to use a descendant selector. In this case, you can specify the class property with the value of sidebar for the div that contains the sidebar and set the value of the class property of the main area to maincontent. Then write the following styles:
Div.sidebar {background:blue;} div.maincontent {background:white;} div.sidebar a:link {color:white;} div.maincontent a:link {color:blue;}
One aspect that is easily overlooked about descendant selectors is that the hierarchical spacing between two elements can be infinite.
For example, if you write ul em, this syntax selects all em elements that inherit from the ul element, regardless of the depth of nesting of the em.
Therefore, ul em will select all em elements in the following tags:
List item 1 List item 1-1 List item 1-2 List item 1-3 List item 1-3-1 List item 1-3-2 List item 1-3-3 List item 1-4 List item 2 List item 3 this ends the study of "how does HTML put a class attribute on each em element found in H1" I hope I can solve everyone's 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.