Wednesday, 20 January 2016

Using IDs and Classes

¢Use an id to distinguish something, like a paragraph, from the others in a document.
For example, to identify a paragraph as “head”, use the code:

<p id=“head”>… </p>
.
Working With Ids
¢To create an ID for a specific tag, use the property:
<tag ID=id_name>
¢To apply a style to a specific ID, use:
#id_name {style attributes and values}

Classes
¢HTML and XHTML require each id be unique– therefore an id value can only be used once in a document.
¢You can mark a group of elements with a common identifier using the class attribute.
<element class=“class”> … </element>
Applying a style to a class


0 comments:

Post a Comment