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>
.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; }
The easiest way:
ul.listing li a { color: black; /* or #000; */ }
ul.listing li a { color: black; }
Source: https://habr.com/ru/post/909664/More articles:HTML5 header structure and page title - html5How to display 2 or more objects in openGL (model - representation - projection matrices and shaders) - shaderHow to debug Google App Engine servlets? - javaWhen using jQuery Mobile, how do I handle the style when JavaScript is disabled? - jqueryRunning jQuery in a static HTML file from Bash - jqueryHow to prevent Resharper error in solution window due to CSS / javascript errors? - c #Loading JPA from external Jar file - springAnimating items added to a ListBox database - windows-phone-7using MergingPersistenceUnitManager to load an object - springDynamically creating delegates with parameter names - c #All Articles