Text Decoration & Pseudo Classes

Text Decoration

Pseudo Classes

<style type="text/css"> /* The following will make all states of the anchor element italic. This is a good place to define any properties that will be applied to all variations of the a element. */ a { font-style:italic; } /* Following is the default state, for unvisited links */ a:link { color: #660; text-decoration:underline; } /* Following is for visited links */ a:visited { color: #440; text-decoration:underline; } /* The following is for when a keyboard key is used to get to a link. */ a:focus { color: #AA0; text-decoration:none; } /*The following is for when a mouse is over a link. */ a:hover { color: #AA0; text-decoration:none; } /* The following is for when link is clicked on but before the link has been made. */ a:active { color: #F00; text-decoration:none; } </style>

Assignment

    1. Create a new html file and name it yourlastname_J08.html
    2. Create one paragraph of Lorem ipsum text.
    3. Inside it, convert three separate long words into links going to, respectively:
      1. http://www.w3.org/wiki/CSS/Properties
      2. http://en.wikibooks.org/wiki/Cascading_Style_Sheets
      3. http://reference.sitepoint.com/css/propertyref
    4. Do not modify the default blue and purple link appearances.
    5. Do not add the target attribute.
    6. In all of the following steps of this exercise, for the next two paragraphs that you will be creating, when styling each appearance of a link:
      • Use one of these css color specification methods for all the colors:
        • color names
        • hex
        • rgb percent
        • rgb integer
      • Whatever color specification method you choose, use it for specifying all the colors.
      • The colors must all be easy to uniquely distinguish and identify by anyone's standards for each of the different pseudo stages you will create.
    7. Copy the paragraph and paste it beneath the first paragraph.
    8. Insert into the <p> tag of the copied paragraph this attribute and value:
      • id=yourfavoritecity (insert your favorite city)
    9. Define a compound selector that will limit the following two rules to only that paragraph. Specify the properties and values that are shown below each rule name:
      • a
        • Dark red with no underline.
      • a:hover
        • Bright green with an underline.
      • Use the id selector to specify a default text color for the paragraph that will work well with the links.
    10. Copy the first paragraph again.
      • Paste the copy underneath both of the other paragraphs.
      • This will make three paragraphs total.
    11. Insert into the <p> tag of the newly copied paragraph this attribute and value:
      • id=yourfavoritesport (insert your favorite sport's name)
    12. Define a compound selector that will limit the effect of all the following rules to the newest paragraph.
      • Give each pseudo class unique combinations of either underlining or no underline along with a different color for each pseudo stage:
        • visited
        • hover
        • active
        • focus
        • link
      • Warning: There is something tricky about the list above, do you know what it is?
      • Hint: I have a love-hate relationship with the world.
    13. Use the id selector for the paragraph to once again specify a default text color for the paragraph text that will visually work well with the links.
    14. I thought I'd add this last step so that you will have good luck with this exercise, instead of ending with step 13!
      ;-)

Further Information