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
<风格>您可以看到我们在
.blue-text {
颜色:蓝色;
}
</样式>
<style>
标记内创建了一个名为blue-text
的CSS类。您可以将类应用于HTML元素,如下所示: <h2 class="blue-text">CatPhotoApp</h2>
请注意,在CSS style
元素中,类名以句点开头。在HTML元素的class属性中,类名不包含句点。 style
元素中,将h2
选择器更改为.red-text
并将颜色的值从blue
更新为red
。为您的h2
元素提供值为'red-text'
的class
属性。 h2
元素应该是红色的。
testString: 'assert($("h2").css("color") === "rgb(255, 0, 0)", "Your h2
element should be red.");'
- text: 你的h2
元素应该有red-text
类。
testString: 'assert($("h2").hasClass("red-text"), "Your h2
element should have the class red-text
.");'
- text: 样式表应声明一个red-text
类,并将其颜色设置为红色。
testString: 'assert(code.match(/\.red-text\s*\{\s*color\s*:\s*red;\s*\}/g), "Your stylesheet should declare a red-text
class and have its color set to red.");'
- text: '不要在h2
元素中使用style="color: red"
内联样式声明。'
testString: 'assert($("h2").attr("style") === undefined, "Do not use inline style declarations like style="color: red"
in your h2
element.");'
```
Click here to view more cat photos.
Things cats love:
Top 3 things cats hate: