在 Google Chrome 中显示 HTML 错误?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2224055/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 02:08:33  来源:igfitidea点击:

Show HTML errors in Google Chrome?

htmldebugginggoogle-chrome

提问by Brian M. Hunt

Can Google Chrome show HTML errors (e.g. unclosed <div>tags)?

谷歌浏览器可以显示 HTML 错误(例如未关闭的<div>标签)吗?

If so, how does one do it?

如果是这样,如何做到这一点?

采纳答案by uthark

~Use HTML Validator extension.~

~使用 HTML 验证器扩展。~

https://chrome.google.com/extensions/detail/cgndfbhngibokieehnjhbjkkhbfmhojo- link is dead. Try validators recommended in other answers

https://chrome.google.com/extensions/detail/cgndfbhngibokieehnjhbjkkhbfmhojo- 链接已失效。尝试其他答案中推荐的验证器

回答by Mr_Chimp

Another options is to use the W3C validator "favelets" to open the W3C validator from a bookmark.

另一种选择是使用 W3C 验证器“favelets”从书签打开 W3C 验证器。

http://validator.w3.org/favelets.html

http://validator.w3.org/favelets.html

回答by Josh

I'm not sure it can do exactly what you're after without an extension. You can use the developer tools to explore the HTML to see if it is what you expect/intend, but I don't think it will tell you where there are errors.

我不确定它是否可以在没有扩展的情况下完全满足您的需求。您可以使用开发人员工具来探索 HTML 以查看它是否符合您的预期/意图,但我认为它不会告诉您哪里存在错误。

HTML browsers are designed to be able to taken invalid markup and render it as best they can. It will have a very high tolerance for errors.

HTML 浏览器旨在能够采用无效标记并尽可能地呈现它。它将对错误有很高的容忍度。

You may want to try an extension like one of these.

您可能想尝试像其中之一这样的扩展。

回答by Tim

There is a new HTML5 validator for based on libTidy (same as the firefox version)

有一个新的基于 libTidy 的 HTML5 验证器(与 firefox 版本相同)

https://chrome.google.com/webstore/detail/anjdemaoejlpgmnmkijdemoiebcddhkc

https://chrome.google.com/webstore/detail/anjdemaoejlpgmnmkijdemoiebcddhkc

回答by jmagnusson

I prefer Validityas it shows errors in the devtools console. It also lets you set up a list of hostnames where it should run on each page load which has been super useful for me during development.

我更喜欢Validity,因为它会在 devtools 控制台中显示错误。它还允许您设置一个主机名列表,它应该在每个页面加载时运行,这对我在开发过程中非常有用。