HTML and CSS Reference
In-Depth Information
a:link { background-color: #ffffff;
color: #ff0000;
}
a:visited { background-color: #ffffff;
color: #00ff00;
}
a:focus { background-color:#000000;
color: #cccccc;
text-decoration:none;
}
a:hover { background-color: #ffffff;
color: #000066;
text-decoration: none;
}
a:active { background-color: #ffffff;
color: #cccccc;
text-decoration:none;
}
</style>
</head>
<body>
<div>
<h1>Navigation Links</h1>
<p><a href="http://yahoo.com">Yahoo!</a>
<a href="http://google.com">Google</a></p>
</div>
</body>
</html>
Save your file as link1.html. Test your page in a browser and compare it with Figure 7.5.
The student files contain a sample solution at Chapter7/link1.html. The browser applies
the CSS pseudo-class rules to every link on the page. Experiment with hovering over the
hyperlinks or using your keyboard to tab to the links. Press the Enter key to use the
keyboard to activate a hyperlink. In this example, the CSS was coded using embedded
styles, but an external style sheet also could have been used.
Part 2
Now you will create a page that uses CSS and pseudo-classes to configure navigation
links that look like buttons. These can be used in place of image links to save on the
bandwidth used by graphics. See the sample in Figure 7.6. When the mouse hovers over
a navigation button, the text color and border change.
Figure 7.6
The hyperlink's
appearance
changes when the
mouse hovers
Search WWH ::




Custom Search