Freecodecamp: 错误的解决方案通过测试

创建于 2016-11-24  ·  4评论  ·  资料来源: freeCodeCamp/freeCodeCamp

挑战导入Google字体存在问题。
用户代理是: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.100 Safari/537.36 Vivaldi/1.5.658.44
请描述如何重现此问题,并在可能的情况下包括指向屏幕截图的链接。

针对此挑战的说明和测试表明,您应该将Lobster字体应用于h2元素,但使用Monospace保留p元素。

因此,这意味着正确的解决方案是创建仅针对h2元素的选择器:

<style>
  .red-text {
    color: red;
  }

  p {
    font-size: 16px;
    font-family: Monospace;
  }

h2 {
    font-family: Lobster;
}
</style>

但是,即使该代码也将p元素的字体更改为Lobster,也可以通过。

<style>
  .red-text {
    color: red;
    font-family: Lobster, Monospace;
  }

  p {
    font-size: 16px;
    font-family: Monospace;
  }
</style>

<h2 class="red-text">CatPhotoApp</h2>

<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>

我们是否应该修改测试,以便必须有单独的h2选择器?

help wanted

最有用的评论

我会解决这个问题。 自从我做出贡献以来已经有一段时间了。

所有4条评论

已确认。

哇! 它也适用于下一个挑战:指定字体应如何降级

接得好。 谢谢@ Margaret2 @ Manish-Giri和@marhyorh。
任何人都准备好应对这两个挑战的测试吗?

我会解决这个问题。 自从我做出贡献以来已经有一段时间了。

此页面是否有帮助?
0 / 5 - 0 等级