निम्न CSS का प्रभाव क्या होगा?
What will be the effect of the following CSS?
div[class^="box-"] {
background-color: yellow;
} The selector div[class^="box-"] is a CSS Attribute Selector. Here is the breakdown of how it works:
-
div: This part targets onlyelements.[class...]: This looks for theclassattribute within those elements.^=: This is the "starts with" operator. It tells the browser to match elements whose attribute value begins with the specified string."box-": This is the specific string it is looking for.Other Selector Symbols
For your exams, it is helpful to remember these three common attribute matchers:
-
^=(Starts with):div[class^="box-"]matches.$=(Ends with):div[class$="-box"]matches.*=(Contains):div[class*="box"]matches.Correct Answer: B) Only divs with class starting with "box-" will have yellow background