Learn how to change the appearance of anchored links of a web page using cascading style sheets.
link styles in Internet Explorer, style sheets and web page links, mouse rollover link color change
Link styles in Internet ExplorerGo to Link styles in Internet ExplorerHTML & JavaScriptGo to HTML and JavaScript tips and tricksTips and tricksGo to web development Tips and tricksHomepage

Link styles in Internet Explorer

The previous tip showed how to make links on a web page more spicy. Internet Explorer 4.0 and above, lets you specify styles to unclicked, visited and active links through A:LINK, A:VISITED and A:ACTIVE selectors, respectively. These are called Pseudo-classes. (The support for Psuedo-classes is partial in Netscape).

Further, I.E. supports another Pseudo-class, A:HOVER that determines the style for mouse rollover effect on links.

The Pseudo-classes should be placed inside the HEAD section, between <STYLE> - </STYLE> tags.


<STYLE TYPE="TEXT/CSS">

A:LINK     {font-family: Verdana, Sans-serif;
            color:#00CC00;
            text-decoration:none;
            font-size:12pt}

A:VISITED  {font-family: Verdana, Sans-serif;
            color:#009900;
            text-decoration:line-through;
            font-size:12pt}

A:ACTIVE   {font-family: Verdana, Sans-serif;
            color:#FF0000;
            text-decoration:none;
            font-size:12pt}

A:HOVER    {font-family: Verdana, Sans-serif;
            color:#00CCFF;
            text-decoration:underline;
            font-size:12pt}

</STYLE>

Using the above style, unvisited links would be light green in color without underlines, visited links would be struck through and in a darker shade of green and active links would be red in color without underlines. On mouse over, links would be underlined and changed to a bright shade of blue.

Now whenever you to place a link on the page, their appearance will be determined by the pseudo-classes. To see how this works, move your mouse cursor over the link below and click on it.

Nowhere to go


The style information will determine the behavior of all links in the document. You can also name the pseudo-classes and refer these with the CLASS attribute if you want more than one link style in the same document.

A:LINK.implink      {color:#FF0000}
A:VISITED.implink   {color:#990000}
A:ACTIVE.implink    {color:#0000FF}
A:HOVER.implink     {color:#000000}


<A HREF="someplace.html" CLASS="implink">Someplace</A>


AddThis Social Bookmark Button


Page contents: Changing the appearance of hyperlinks on a web page using cascading style sheets.

Page URL: http://www.webdevelopersnotes.com/tips/html/ link_styles_in_internet_explorer.php3



Join Mailing List


Feedback/Questions




50+ web hosting FAQs

Search engine for your website

Free software from Google - The Google Pack Collection

Create your own search engine
Search WebDevelopersNotes.com