I toyed with something similar a few years ago, although didn't pursue it to this depth. One issue, though: border is definitely not the right way to highlight elements in this manner since it affects layout. I'd go with outline instead.
Soundly checking HTML, including all kinds of customization and more is possible using SGML.<p>[1]: <a href="http://sgmljs.net/blog/blog1701.html" rel="nofollow">http://sgmljs.net/blog/blog1701.html</a>
This is a good choice of selectors, but I wonder what styles one should apply to <meta>, <script>, or <link> tags that will get them to actually display anything. Some fiddling in Firefox didn't reveal the solution.
<p><pre><code> a:not([href])
a[href="#"],
a[href=""],
a[href*="javascript:void(0)"] { … }
</code></pre>
Wait, what should I use instead then?
Reminds me how some video games would use really garish default textures, so that the errors in texturing stand out.<p>I believe Thief 1 and 2 have done this, but I may be wrong.
Interesting idea though I think the best choice is a VLI linting tool configured to check these and editor integration.<p>You could also use JS and log the info to console. Last thing you want to do is this making its way into production and it probably will: sods law.<p>I just think the most efficient approach is to log violations to a console with exact line numbers.
Hi guys i already made a github repo as a follow up from this article you can check it here: <a href="https://github.com/lendk/Lint-HTML-with-SCSS-CSS" rel="nofollow">https://github.com/lendk/Lint-HTML-with-SCSS-CSS</a>
Very cool trick. If interested, there is a node cli module which tests against W3.<p><pre><code> npm install html-validator-cli -g
cd "$HOME"/Sites/mysite
html-validator --verbose --file=index.html</code></pre>
broken XML leading to browsers applying inconsistent closing tags is a much bigger issue than missing attributes or inline CSS<p>this kind of linting can't spot broken document structure
If you have to apply CSS to find elements with inline styles, I think you have a more serious problem.<p>And telling everyone that every one of their images must have an alt tag is draconian. Sometimes an image is purely decorative. Sometimes an image doesn't convey any more than the paragraph beside it. Often an alt tag is written in a perfunctory way, or even when it isn't, it doesn't truly make things better for the blind person. I think they should be at the writer's discretion.