簡體   English   中英

| 元素鏈接上的屬性 href 不允許使用字符

[英]| character is not allowed for attribute href on element link

我在 .html 文件中有一個鏈接元素:

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

當我把它扔進 https://validator.w3.org/時,它顯示這個錯誤:

元素鏈接上的屬性 href 的錯誤值https://fonts.googleapis.com/css?family=Lora|Merriweather:300,400 :查詢中的非法字符:| 不被允許。

我該如何解決?

UrlEncode 違規| 最終為%7C

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

要在瀏覽器和插件中顯示非標准字母和字符,您需要使用十六進制值。 在你的情況下而不是 | 你需要使用 %7C。

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

你可以在這里查看更多

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM