Setting the Foreground Color

color property sets the foreground color of an element.

 
<!DOCTYPE HTML> 
<html> 
    <head> 
        <title>Example</title> 
        <style> 
            p { 
                padding: 5px; 
                border: medium double black; 
                background-color: lightgray; 
                font-family: sans-serif; 
            } 
            #myID { 
                font-size: x-large; 
                border: medium solid white; 
                background-color: green; 
                color: rgba(255, 255, 255, 0.7); 
            } 
            a:hover { 
                color: red; 
            } 
        </style> 
    </head> 
    <body> 
    <p> 
        
        <span id="myID">CSS</span>
        <a href="http://java2s.com">java2s.com</a> 
    </p> 
</body> 
</html>
  
Click to view the demo
Home 
  HTML CSS Book 
    CSS  

Foreground Color Opacity:
  1. Setting the Foreground Color
  2. Setting Element Opacity
Related: