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: bad87dee1348bd9aede07836 title: Use an id Attribute to Style an Element challengeType: 0 videoUrl: 'https://scrimba.com/c/cakyZfL' forumTopicId: 18339 dashedName: use-an-id-attribute-to-style-an-element --- # --description-- One cool thing about `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: ```css #cat-photo-element { background-color: green; } ``` Note that inside your `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. # --instructions-- Try giving your form, which now has the `id` attribute of `cat-photo-form`, a green background. # --hints-- Your `form` element should have the id of `cat-photo-form`. ```js assert($('form').attr('id') === 'cat-photo-form'); ``` Your `form` element should have the `background-color` of green. ```js assert($('#cat-photo-form').css('background-color') === 'rgb(0, 128, 0)'); ``` Your `form` element should have an `id` attribute. ```js assert( code.match(/
Click here to view more cat photos.
Things cats love:
Top 3 things cats hate:
Click here to view more cat photos.
Things cats love:
Top 3 things cats hate: