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
monospace
, serif
和sans-serif
当一个字体不可用时,您可以告诉浏览器“降级”为另一种字体。例如,如果您希望元素使用Helvetica
字体,但在Helvetica
不可用时降级为sans-serif
字体,则将按如下方式指定: p {通用字体系列名称不区分大小写。此外,它们不需要引号,因为它们是CSS关键字。
font-family:Helvetica,sans-serif;
}
monospace
字体应用于h2
元素,以便它现在有两种字体 - Lobster
和monospace
字体。在上一个挑战中,您使用link
标记导入了Lobster
字体。现在注释掉谷歌字体导入的Lobster
字体(使用之前学过的HTML评论),以便它不再可用。注意你的h2
元素如何降级为monospace
字体。 注意 Lobster
。
testString: 'assert($("h2").css("font-family").match(/^"?lobster/i), "Your h2 element should use the font Lobster
.");'
- text: 当Lobster
不可用时,你的h2元素会降级为monospace
字体。
testString: 'assert(/\s*h2\s*\{\s*font-family\:\s*(\"|")?Lobster(\"|")?,\s*monospace\s*;\s*\}/gi.test(code), "Your h2 element should degrade to the font monospace
when Lobster
is not available.");'
- text: 通过在其前面放置<!--
来注释您对Google的Lobster
字体的调用。
testString: 'assert(new RegExp("", "gi").test(code), "Be sure to close your comment by adding -->
.");'
```
Click here to view more cat photos.
Things cats love:
Top 3 things cats hate: