136
Apply Styles with IDs ............................................
2 Within a tag to which you
want to apply the style,
type id=”?”, replacing?
with an ID.
1 In your editor, open a page
that contains an embedded
style sheet.
Apply Styles with IDs
J
ust as with a class, an ID selector allows you to create a generic set of style rules and then apply
them to your page via the matching HTML attribute, ID. An important distinction, however, is
that an ID selector can be applied only to a single tag on an HTML page, whereas a class selector can
in theory be applied to as many elements on the page as you want. In your CSS, the ID selector must
begin with a pound sign (#), but the sign is not repeated in the matching HTML attribute.