Resources | CSS | Multiple Anchor Styles

Justifying Text:


In one of our other tutorials, we gave an example of using borders around your anchor tag styles to use in a CSS-styled menu system. This tutorial will show you how to use more than one anchor style per page, which is especially useful if you are using a CSS-menu and need to use a different style for anchor tags that are not a part of the menu. While this tutorial uses anchor tags for the example, this technique can be applied to any TAG's style that you put in your cascading style sheets.

With CSS, way to say "style an X inside a Y" is:
  • Y.X { ... }
Here's an example from a Cascading Style Sheet that I used. The "menu" anchor class was used for the site's navigation, while the "reg" anchor class was used for anchor tags within the general content of the page:

Then, within your BODY tag, you would set up the menu with a tag like this:
  • <a href="index.html" class="menu">Home</a>
A regular tag would be set up this way:
  • <a href="someotherpage.html" class="menu">Some Other Link</a>



Related Links: Anchor Tag Properties

Comment on this article or ask us a question: click here !
armbrustconsulting.com