Multiple Link Styles Using Class Selectors

Another fantastic option made available via CSS is the capability to have more than one style of links per document. This is especially helpful when you have areas on a page with distinctly different features than other areas of the page. A perfect example is a navigation area with a blue background, and a content area with a white background. If you wanted white links on the blue background, it clearly couldn't work within the white content because the links would be invisible.

You can approach multiple link styles in a few ways, including creating separate classes. You could have basic link styles for the default and content areas, and you could set up a special class for the navigation area ...

Get Spring Into HTML and CSS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.