Click here to view more cat photos.
Things cats love:
- cat nip
- laser pointers
- lasagna
Top 3 things cats hate:
- flea treatment
- thunder
- other cats
id
attributes is that, like classes, you can style them using CSS.
However, an id
is not reusable and should only be applied to one element. An id
also has a higher specificity (importance) than a class so if both are applied to the same element and have conflicting styles, the styles of the id
will be applied.
Here's an example of how you can take your element with the id
attribute of cat-photo-element
and give it the background color of green. In your style
element:
#cat-photo-element {Note that inside your
background-color: green;
}
style
element, you always reference classes by putting a .
in front of their names. You always reference ids by putting a #
in front of their names.
id
attribute of cat-photo-form
, a green background.
form
element the id of cat-photo-form
.
testString: assert($("form").attr("id") === "cat-photo-form", 'Give your form
element the id of cat-photo-form
.');
- text: Your form
element should have the background-color
of green.
testString: assert($("#cat-photo-form").css("background-color") === "rgb(0, 128, 0)", 'Your form
element should have the background-color
of green.');
- text: Make sure your form
element has an id
attribute.
testString: assert(code.match(/form
element has an id
attribute.');
- text: Do not give your form
any class
or style
attributes.
testString: assert(!code.match(/form
any class
or style
attributes.');
```
Click here to view more cat photos.
Things cats love:
Top 3 things cats hate: