Duy Duy
Duy Duy

Reputation: 621

| character is not allowed for attribute href on element link

I have a link element in .html file:

<link href="https://fonts.googleapis.com/css?family=Lora|Merriweather:300,400" rel="stylesheet">

When I throw it in https://validator.w3.org/, it displays this error:

Bad value https://fonts.googleapis.com/css?family=Lora|Merriweather:300,400 for attribute href on element link: Illegal character in query: | is not allowed.

How can I fix that?

Upvotes: 3

Views: 577

Answers (2)

Ekaterine Mitagvaria
Ekaterine Mitagvaria

Reputation: 56

To display non-standard letters and characters in browsers and plug-ins you need to use hexadecimal values. In your case instead of | you need to use %7C.

 <link href="https://fonts.googleapis.com/cssfamily=Lora%7CMerriweather:300,400" rel="stylesheet">

You can check more here

Upvotes: 3

Lee Taylor
Lee Taylor

Reputation: 7984

UrlEncode the offending | which ends up as %7C

<link href="https://fonts.googleapis.com/css?family=Lora%7CMerriweather:300,400" rel="stylesheet">

Upvotes: 2

Related Questions