Choosing an item inside a div to decode CSS

I want to give black color to each element “a” inside the listing class. How can I select the “a” element from the listing class in CSS to achieve this?

<ul class="listing"> <li><a href="#">Jobs</a></li> <li><a href="#">Advertising</a></li> <li><a href="#">Brands</li> <li><a href="#">Small Businesses</a></li> <li><a href="#">FAQ</a></li> <li><a href="#">Privacy Policy</a></li> </ul> 
+6
source share
3 answers

.listing a { color: #000; }

Although, if you determined the use of pseudo-classes elsewhere, you might need to:

.listing a:link, .listing a:visited { color: #000; }

+6
source

The easiest way:

 ul.listing li a { color: black; /* or #000; */ } 
+2
source
 ul.listing li a { color: black; } 
+2
source

Source: https://habr.com/ru/post/909664/


All Articles