HTML Cascading Style Sheets ID
CSS ID
In the last lesson on Classes in CSS we discussed the manner in which you can transform elements by creating a class. Classes work throughout the document. However, you may want to change only one element in one instance. In this situation, you should create an ID for that particular element. An ID should only be used once. An element can only have one ID and each page should only have one instance of that ID. CSS code will not pass validation if you use the same ID more than once on the same page. Classes can be used on multiple elements and used multiple times.
Here is an example of how you create an ID.
<style>
#idExample {
color: green;
font-weight: bold;
font-size: large;
}
</style>
I used the actual ID code to format the example code. In your html, you would use the tags
<span id="idExample"> </span>>
and insert the code you wish to format with the ID "idExample" between the tags, with your ID defining code in the head or style sheet, just as with your class definitions.
I hope you will join us for the next lesson Lesson 4) Divisions <div></div>
Additional Resources