Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS How to Make a Website Responsive Web Design and Testing Website Testing

Paul O'Connor
PLUS
Paul O'Connor
Courses Plus Student 2,510 Points

At the stage where I am testing my HTML in the W3C Validation Service and am getting an error message

I am at the stage in Nick's Front End Web Design course where I am validating the code on the W3C validation Service. In the video Nick's code passes fine, in my test I am getting an error message that is specific to the Google Font link that I copy and pasted in.

Line 7, Column 142: Bad value http://fonts.googleapis.com/css?family=Changa+One|Open+Sans:400italic,700italic,400,700,800 for attribute href on element link: Illegal character in query: not a URL code point. …ne|Open+Sans:400italic,700italic,400,700,800' rel='stylesheet' type='text/css'> Syntax of URL: Any URL. For example: /hello, #canvas, or http://example.org/. Characters should be represented in NFC and spaces should be escaped as %20.

I suppose my question is - what do I have to do to alter the code to clear this error? Any help or advice will be gratefully received, thanks.

Hugo Paz
Hugo Paz
15,622 Points

Hi Paul,

Could you please post your head code here?

4 Answers

Gavin Ralston
Gavin Ralston
28,770 Points

Well, it's pointing you to this line of code:

<link href='http://fonts.googleapis.com/css?family=Changa+One|Open+Sans:400,400italic,700,700italic,800' rel='stylesheet' type='text/css'>

See that pipe character? |

That's your problem. Replace the | with %7C

Just replace it like so:

<link href='http://fonts.googleapis.com/css?family=Changa+One%7COpen+Sans:400,400italic,700,700italic,800' rel='stylesheet' type='text/css'>
Gavin Ralston
Gavin Ralston
28,770 Points

Looks like this has come up a few times in the HTML forum on Treehouse already.

Google fonts links in w3c validator

John Mueller
John Mueller
719 Points

Gavin Ralston I had the same problem with http://fonts.googleapis.com/css?family=Changa+One|Open+Sans:400italic,700italic,400,700,800 line but I'm curious as to why the %7 works. I copy and pasted the code from Google Fonts instelf.

Paul O'Connor
PLUS
Paul O'Connor
Courses Plus Student 2,510 Points

Thanks to those who answered (Gavin, your right I should have checked the forum first before posting).

Hi, I have struggled for a long time attempting to understand why the google fonts url reference line of code had an illegal "query". What exactly does %7C mean, what is it's function, and why/how is it different from the pipe character?

Thanks Gavin Ralston!!