| Previous Page | Table of Contents | Next Page |
Recipe 3.1 Removing Underlines from LinksProblemLinks in a web document are underlined. You want to remove the underlining, as shown in Figure 3-1. Figure 3-1. Links without underlines![]() SolutionUse the text-decoration property with the pseudo-class selector for unvisited and visited links: a:link, a:visited {
text-decoration: none;
}DiscussionUse the :link and :visited pseudo-classes to apply styles to links within a web document. The :link pseudo-class applies to links that the user has not visited. The :visited pseudo-class corresponds to links that the user has visited. The text-decoration property can take up to five settings, shown in Table 3-1.
These text-decoration text-decoration to none in conjunction with changing the link's background color, text color, or both: a:link, a:visited {
text-decoration: none;
background-color: red;
color: white;
}In order to complement the design for those site visitors who might have a:link, a:visited {
font-weight: bold;
text-decoration: none;
color: red;
}See AlsoThe CSS 2.1 specification for the text-decoration property at http://www.w3.org/TR/CSS21/text.html#propdef-text-decoration, Jakob Neilson's updated "Design Guidelines for Visualizing Links" at http://www.useit.com/alertbox/20040510.html. |
| Previous Page | Table of Contents | Next Page |
| |||||||||||||||||||