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 How to Make a Website Responsive Web Design and Testing Website Testing

Google font validation issue

I am using Google font in one of my work. It seems it is not validating. Do I need to fix that? If so how?

Thanks again. @bappygolder

4 Answers

I'm not sure what you mean by not validating. Can you include the relevant sections of HTML and CSS code?

Should look something like this:

HTML

<head>
    <link href='http://fonts.googleapis.com/css?family=Domine|Lato:400,700' rel='stylesheet' type='text/css'>
</head>

CSS

body {
    font-family: 'Lato', sans-serif;
}

Ok, I solved it!

You need to url encode the pipe characters ' | ' . Replacing them with %7c will make validation successful.

<head>
    <link href='http://fonts.googleapis.com/css?family=Megrim%7cOpen+Sans:300italic,400italic,600italic,300,400,800%7cOpen+Sans+Condensed:300,300italic,700' rel='stylesheet' type='text/css'>
</head>

I am getting the following warning:

Line 7, Column 187: Bad value http://fonts.googleapis.com/css?family=Megrim|Open+Sans+Condensed:300,300italic,700|Open+Sans:300italic,400italic,600italic,400,300,600 for attribute href on element link: Illegal character in query: not a URL code point. ā€¦s:300italic,400italic,600italic,400,300,600' rel='stylesheet' type='text/css'/> Syntax of IRI reference: Any URL. For example: /hello, #canvas, or http://example.org/. Characters should be represented in NFC and spaces should be escaped as %20.

for my html in line 7 which is:

<head>
    <link href='http://fonts.googleapis.com/css?family=Megrim|Open+Sans+Condensed:300,300italic,700|Open+Sans:300italic,400italic,600italic,400,300,600' rel='stylesheet' type='text/css'/>
</head>

And by validating I mean w3c validating