You can now use the new Linux command line tool htmlval for checking HTML and CSS. With the Linux version, you can use curl to download a URL and pipe it to htmlval.
It will work offline, but of course you need to be online if you're going to fetch a URL from the Internet.
There's also a Windows version of the program.
Note: I'm the developer.
Testing this HTML (in file example.html):
<meta name="viewport" content="width=device-width, initial-scale=1">
<span>span has no end tag
With this command (-l for list format, -S for no SEO messages):
htmlval -lS example.html
Produces this error list:
=== File 1 of 1: example.html ===
Error (line 6, col 11): This document has a <title> element but it does not contain a title when it must. Each page on a site should have its own unique (never duplicated) and well-written title.
Error (line 9, col 2): The <badtag> element is not valid. Is it misspelled?
Error (line 10, col 2): The <span> element must have an end tag (</span>) but the end tag was not found, is misplaced, misspelled, or was not seen due to other errors.
Error (line 11, col 2): The end tag for <span> (started in line 10, column 2) should appear before this </body> end tag or this end tag should be deleted or moved. This is a nesting error.
Comment: "Errors and warnings only" mode enabled. Showing only error and warning messages (with some exceptions).