Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > Adobe Dreamweaver

  • Print
  • + Share This
From the author of

Creating the Default Link Selectors

The default link selectors apply to all hyperlinked text on a page. Here, again, is how ours look:

a:link { color: #333333}
a:visited { color: #FFFFFF}
a:hover { color: #CCCCCC; background-color: #333333; text-decoration: none}
a:active { color: #333333

Creating the a:link Selector

Let's begin by creating the a:link selector for the hyperlink that has not been visited by the user's browser.

  1. Open a properly defined Dreamweaver site and right-click (Control-click) anywhere on the page.

    We do not tell you how to define a Dreamweaver site or provide screen captures for every step in this article. We assume that anyone interested in learning about CSS should already have a good understanding of Dreamweaver basics, such as defining a Dreamweaver site, creating a new file, and inserting a table. If you do not yet know how to do these things, please refer to your Dreamweaver manual or the online help within Dreamweaver.

  2. From the popup menu, choose CSS Styles, New Style.

  3. Select the Use CSS Selector radio button.

  4. Open the Selector list and choose a:link ( Figure 1).

  5. Figure 1

  6. Select the Define In radio button and select New Style Sheet File in its list.

  7. Click OK.

Creating a Linked Style Sheet File

Whoa! Not only are we learning about link classes, we're also learning how to create a linked style sheet! The only property we are going to set is Color.

  1. As soon as you click OK, the Save Style Sheet File As window will open (Figure 2).

    Figure 2

  2. Make sure the Save In field is pointing to a directory within your defined site.

  3. Type a name in the File name field (making sure you include the .css extension after the name).

    Dreamweaver will fill in the URL as you type the file name.

  4. Make sure Relative To is set to your site's proper mode (usually Document).

  5. Click Save. The Style Definition Window will open and the title bar will read: for a:link in mystyles.css ( Figure 3).

    Figure 3

  6. You now have a genuine linked style sheet. This single style sheet can be linked to every page in your site. So, to change the look of your site, you need edit only a single style sheet! (See Linking Style Sheets to Existing Pages below)

  7. Enter #333333 in the Color field (of course, you can open the color picker to choose a color from the web-safe palette or pick up a color from your page with the eyedropper if you prefer).

  8. Click OK, and the Style Sheet window will appear with your new selector listed (Figure 4).

    Figure 4

Creating the a:visited Selector

In this section we create the a:visited Selector. The only property we are going to set is Color.

  1. Click the New button.

    The New Style window will open again and will display the settings present when the previous style was created.

  2. Select a:visited from the Selector list.

  3. Click OK.

    The Style Definition Window will open and the title bar will reference for a:visited in mystyles.css.

  4. Enter #FFFFFF in the Color field.

  5. Click OK.

    The Style Sheet window will appear with your two Selectors listed

Creating the a:hover Selector

In this section, you set up the a:hover Selector that appears when the mouse hovers over a link.

  1. Click the New button again and repeat the above procedure to add a third Selector (Figure 5).

    Figure 5

  2. Set a:hover Text Decoration to none.

  3. Set Color to #CCCCCC.

  4. Leave the Style Definition window open.

  5. Switch to the Background Category by selecting it from the Category list on left side of the window.

    Figure 6

  6. Enter #333333 in the Background Color field.

  7. Click OK.

Creating the a:active Selector

In this section you create the a:active Selector that indicates when a user that has clicked on a hyperlink but not yet released the mouse button.

  1. Click the New button and create the fourth Selector a:active

  2. Set a:active color to #333333 (just like a:link)

  3. Click OK and we're done!

Linking Style Sheets to Existing Pages

Dreamweaver makes creating a linked style sheet very easy, as we saw above. To realize the benefits and efficiencies of a linked CSS file, you may want to know how to link your existing pages to your new CSS file. Here's how:

  1. Open the page to which you want to link your style sheet.

  2. Right-Click (Control-Click) anywhere on your page, and, in the context menu that pops up, choose CSS Styles, Attach Style Sheet.

    The Select Style Sheet File window will open ( Figure 7).

    Figure 7

  3. Select your Style Sheet file.

  4. Click the Select button.

  • + Share This
  • 🔖 Save To Your Account