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: