Setting the Foreground Color

Description

color sets the foreground color of an element. Its value is standard CSS color value.

Example

The color property sets the foreground color for the element.


<!DOCTYPE HTML>
<html>
<head>
<style>
p  {<!--  w  ww .j a v  a 2  s  .c  om-->
    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 id="mytext">
        this is a <span  id="myID">test</span>.
        <a href="http://java2s.com">tutorial</a>
    </p>
</body>
</html>

Click to view the demo





















Home »
  HTML CSS »
    CSS »




CSS Introduction
CSS Background
CSS Border
CSS Box Layout
CSS Text
CSS Font
CSS Form
CSS List
CSS Selectors
CSS Others
CSS Table