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

HTML

I got an error when running my html through validator.w3.org. Don't know how to fix it so it passes?

Here is the code that I entered.

link href='http://fonts.googleapis.com/css?family=PT+Serif:400,700|Open+Sans:400,700' rel='stylesheet' type='text/css'

I did not include the brackets in this forum because it was not showing up in this forum for some reason, but in my workspace I do have the brackets at the beginning and end of the line of code.

This is the error that I get, Error Line 7, Column 124: Bad value http://fonts.googleapis.com/css?family=PT+Serif:400,700|Open+Sans:400,700 for attribute href on element link: Illegal character in query: not a URL code point. …ss?family=PT+Serif:400,700|Open+Sans:400,700' rel='stylesheet' type='text/css'>

What am I doing wrong?

1 Answer

Hey Roger,

You have to use URL encoding on certain characters in a URL such as the | character. I've contacted the Google Fonts team about this, but I haven't heard anything back. But, if you want your form to validate, you have to, at least, encode the | to %7C like so:

<link href='http://fonts.googleapis.com/css?family=PT+Serif:400,700%7COpen+Sans:400,700' rel='stylesheet' type='text/css'>

Thank you, I wondered how this was not passing when I copied and pasted it from the google font page. Thanks again I will have to write this down so I know this in the future.

No problem, Roger! We probably need more people writing to them to fix it. I sent them a tweet (that was the only method of communication I could find for them). I think if they get a few hundred tweets about handing out URL encoded URLs they would do it haha!