question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Erroneous behavior in "Specify How Fonts Should Degrade" challenge

See original GitHub issue

Challenge Name

Challenge Link

Issue Description

The challenge aims to show how fonts degrade to the available one, if the specified fonts are not available. However, if you embed the h2 styles inside the stylesheet within HTML comment tags, like so -

  <!--h2 {
    font-family: Lobster, Monospace;
  }-->

The test passes.

This seems odd, because HTML comments <!--> --> should have no effect inside embedded style sheet. Newer browsers just ignore the HTML comment tags in the stylesheet, as per the spec, so placing comment tags in there shouldn’t make any difference. This behavior can be seen in this pen, where placing comment tags around the h2 in the stylesheet makes no difference to the Lobster font on h2. The same behavior is visible in the challenge page too.

Yet, it looks like placing the comment tags around h2 inside style tags seems to have acheived the desired result.

Browser Information

  • Browser Name, Version: Google Chrome, Version 55.0.2883.87 m
  • Operating System: Windows 10
  • Mobile, Desktop, or Tablet: Desktop

Your Code

 
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
  .red-text {
    color: red;
  }

  <!--h2 {
    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>

Screenshot

aa

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:32 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
yundercommented, Jan 10, 2017

I cannot get past this test. I have followed the instructions–is it a bug? (I have commented out the link to Google’s Lobster font by surrounding the link with ; and I have specified that h2 should have Monospace as the alternate font should Lobster not be available

0reactions
saifazmicommented, Jun 13, 2018

@Manish-Giri the challenge does work for me, the issue is with the preview window itself. The tests work just fine.

Firefox: clipped-2018-06-13-10 34 16 Chrome: windowshot-2018-06-13-10 36 21

In both the cases, you can see that it still renders the Lobster font.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Basic CSS: Specify How Fonts Should Degrade, I keep getting ...
Okay so when I run the test after I finish the lesson, I get an error saying “Your h2 element should use the...
Read more >
Specify How Fonts Should Degrade - Snakify
Solve problem "Specify How Fonts Should Degrade" online - Learn Python 3 - Snakify.
Read more >
Basic CSS: Specify How Fonts Should Degrade - YouTube
Today we use basic css to specify how fonts should degrade depending on the different users of your application. Please like, comment and ......
Read more >
Specify How Fonts Should Degrade, freeCodeCamp review ...
In this challenge we learn how to degrade from a chosen font -family when our first choice is not available in certain browsers....
Read more >
Understanding the Effect of Font Type on Reading ...
The researchers explain that serif fonts have markings that make rows of text appear to set upon a line, thereby making it perceptually...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found