Different color for a link - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Color

Description

Different color for a link

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">

a {<!-- w w w .  j a  v a2 s . co m-->
   text-decoration: underline;
   color: blue;
}
#abc a {
   color: green
}
#abc #def a {
   color: red;
}
#xyz a {
   color: purple;
}
#xyz a#two {
   color: orange;
}
#ghi a {
   color: brown;
}
#ghi a.secondary {
   color: grey;
   font-weight: bold;
}


      </style> 
 </head> 
 <body> 
  <div id="abc"> 
   <a>This link is green.</a> 
   <div id="def"> 
    <a>This link is red.</a> 
   </div> 
  </div> 
  <a>This link is blue.</a> 
  <div id="xyz"> 
   <a>This link is next to that link.</a> &nbsp; 
   <a id="two">This link isn't the same color, though!</a> 
  </div> 
  <p>&nbsp;</p> 
  <div id="ghi"> 
   <a>This is a primary-style link.</a> &nbsp; 
   <a>As is this.</a> &nbsp; 
   <a>And this.</a> &nbsp; 
   <a class="secondary">This is a secondary-style link.</a> &nbsp; 
   <a>This is primary-style again.</a> &nbsp; 
   <a class="secondary">And secondary-style.</a> 
  </div>  
 </body>
</html>

Related Tutorials