Set background for anchor : Anchor « Tags « HTML / CSS

Set background for anchor

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

<html xmlns="">
<style type="text/css">
a:link {
 color: #777; 
 text-decoration: none;
a:visited {
 color: #333;
 text-decoration: none;
a:link:hover, a:visited:hover {
 color: #777;
 background-color: #ccc;
a:link:active, a:visited:active {
 color: #ccc;
 background-color: #ccc;


    <li><a href=" ">V</a></li> 
    <li><a href=" ">S</a></li>
    <li><a href=" ">T</a></li> 
    <li><a href=" ">P</a></li> 



Related examples in the same category

1.Introduction to hyperlinks
2.'link' defines relationship between the current page and external documents
3.A basic link to another page
4.A basic link to an external web site
5.A link with a title attribute
6.A link with white space
7.a name = ".."> creates an internal hyperlink
8.Anchor element
9.relative link
10.background image, repeat and position for anchor link
11.avoid underlining links
12.Set border for an anchor with
  • under
  • 13.Set text-decoration to none for
    14.Anchor hover image style
    15.Set cursor for anchor link and visted
    16.Set text decoration for anchor
    17.Four level nesting for anchor style setting
    18.Using Links - Changing Backgrounds
    19.Using Links with Background Images
    20.Image links
    21.anchor style for removing the underline
    22.Add text decoration for link
    23.Add background image to anchor link
    24.List with anchor
    25.Using images as link anchors
    26.text-decoration, color, background-color for hover anchor