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:
- Create and name a new ID Selector to apply to the paragraph above that starts with:
"An ID Selector's name..."
- Use the existing ID selector's rule as a reference for the new one, but keep the other ID selector's rule intact.
- Specify in the new ID Selector's properties that the paragraph will have:
- blue text
- a margin 75 pixels (75px) from the right
- the font Courier
- text alignment to the right
- position is relative.
- For the margin setting (3-b) use the abbreviation:
px
- Note that the example in the code uses a formerly obscure
typography measurement called an em:
one em equals the width of a lower case "m" in the surrounding text.
- The em is used quite a bit in CSS to help keep things proportionate and scaleable.
- Save the file as CSS_ID_yourlastname.html
- Online students: send it to me by email.
© 2007 Dan Hitchcock Vaughan and its licensors. All rights
reserved.