html - W3C 验证失败,路径段 : space is not allowed 中的非法字符

标签 html css w3c-validation

<img src="webpage photos/alcazar.jpg" alt="Alcazar Palace">

验证器显示的错误:元素 img 上属性 src 的错误值网页照片/alcazar.jpg:路径段中的非法字符:不允许空格。

一旦我删除了空格,我就尝试按照某些在线建议用连字符或 %20 替换它们,我得到更多错误,但网页正常运行。

这里似乎有什么问题?

谢谢

最佳答案

url中不允许有空格,需要替换成%20

As soon as I remove the spaces I try to replace them by hyphens or %20 as recommended by some online I get even more errors

W3C 验证服务会提示缺少doctype 声明和title 元素以及lang 属性

所以当你检查更多的代码时

<!DOCTYPE html>
<html lang="en-us">
<head>
  <title>Some title</title>
</head>
<body>
  <img src="webpage%20photos/alcazar.jpg" alt="Alcazar Palace">
</body>
</html>

你得到 文件检查完成。没有要显示的错误或警告。

关于html - W3C 验证失败,路径段 : space is not allowed 中的非法字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61808950/

相关文章:

java - Jsoup 白名单 : Parsing non-english character

html - 如果另一个 div 有边距,div 将失去其完整高度

javascript - Angular 搜索框

javascript - 在滚动条上移动垂直线

html - 将浏览器切换到严格模式以编写正确的 html 代码

css - 为什么 YUI Reset CSS 没有通过验证?

javascript - 在响应式 div 中居中 div 的最佳方式

html - CSS 文本下划线动画问题

Drupal:IE 兼容性问题

css - 关于在 CSS url() 中使用数据 URI 的有效性的说明