Although very similar to a CSS class selector, an ID selector...

...should only be used once on a page. Also, ID Selectors are often used for positioning.

An ID Selector's name starts with a # sign when initially defined. Like the other CSS selectors, it can be defined in the head of a document as is the case with the example above. See this page's code to see how it's done.

Again, remember that an ID selector should only be used ONCE per page as it is intended to be a unique identifier for that section of the page.

Your Assignment:

  1. Create and name a new ID Selector to apply to the paragraph above that starts with: "An ID Selector's name..."
  2. Use the existing ID selector's rule as a reference for the new one, but keep the other ID selector's rule intact.
  3. Specify in the new ID Selector's properties that the paragraph will have:
    1. blue text
    2. a margin 75 pixels (75px) from the right
    3. the font Courier
    4. text alignment to the right
    5. position is relative.
  4. For the margin setting (3-b) use the abbreviation: px
  5. Save the file as CSS_ID_yourlastname.html
  6. Online students: send it to me by email.

© 2007 Dan Hitchcock Vaughan and its licensors. All rights reserved.