HTML CSS examples for CSS Selector:element parent child
Create selector to take precedence over selectors on parent elements
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> a {<!-- w w w. ja v a 2 s . c o m--> border:2px solid Chartreuse; padding:21px; display:block; } a.gray { background-color:yellow; } a:hover { background-color:blue; } .container a { background-color:pink; } a.pink { background-color:OrangeRed; } </style> </head> <body> <div class="container"> <a>Lorem </a> <a class="pink">Lore</a> <a class="gray">Lore</a> </div> </body> </html>