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属性的一个很酷的事情是,像类一样,你可以使用CSS来设置它们的样式。但是, id不可重用,只应应用于一个元素。 id也具有比类更高的特异性(重要性),因此如果两者都应用于同一元素并且具有冲突的样式,则将应用id的样式。下面是一个示例,说明如何使用cat-photo-element的id属性获取cat-photo-element并为其指定绿色的背景颜色。在你的style元素中: #cat-photo-element {请注意,在
背景颜色:绿色;
}
style元素中,您始终通过放置a来引用类.在他们的名字前面。你总是通过在他们的名字前放一个#来引用id。 cat-photo-form的id属性,绿色背景。 form元素添加cat-photo-form的id。
testString: 'assert($("form").attr("id") === "cat-photo-form", "Give your form element the id of cat-photo-form.");'
- text: 您的form元素应具有绿色的background-color 。
testString: 'assert($("#cat-photo-form").css("background-color") === "rgb(0, 128, 0)", "Your form element should have the background-color of green.");'
- text: 确保您的form元素具有id属性。
testString: 'assert(code.match(/form element has an id attribute.");'
- text: 不要为form任何class或style属性。
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: