1

So, I wanted to be strict on me and took one of HTML5 pages and validated it as XHTML Strict -- all the way.

Fixed every error reading the very helpful error messages. Now the entire page is fully XHTML compliant. But the page shows only the DIVS containing the ads. The main DIV containing the page matter is gone, haha!

Here's the page for your enjoyment: http://mypollingcenter.com/charts1.htm

  • 1
    You're doing it wrong. You don't validate HTML5 against an XHTML doctype for the sake of being strict. You don't validate HTML5 against an XHTML doctype, period. You validate HTML5 with an HTML5 checker. – BoltClock Jul 04 '16 at 03:37
  • Can you post a snippet that demonstrates the issue? A link alone won't do it. See [Something in my web site or project doesn't work. Can I just paste a link to it?](http://meta.stackoverflow.com/q/254428/1016716) Also, you should be much more precise in telling us what goes wrong. Which of the divs is the one "containing the page matter"? What did it use to look like and what does it look like now? What have you tried to make it visible again? – Mr Lister Jul 04 '16 at 06:34
  • @BoltClock Technically you are right and this is an exercise in futility on the OP's part. However, it is my firm belief that attempts at getting a page to validate are always a good idea! No matter the DTD you are validating against. An error-free XHTML page, even if only in an .htm file, is better than a bad HTML5 page. – Mr Lister Jul 04 '16 at 06:41
  • I changed the headings to HTML, Still it does not show. I think this is my error. Please wait till I come back with results. – user6545390 Jul 04 '16 at 10:09
  • Possible duplicate of [Why don't self-closing script tags work?](http://stackoverflow.com/questions/69913/why-dont-self-closing-script-tags-work) – Sebastian Simon Jul 04 '16 at 12:14

1 Answers1

0

Well, I apologize. The problem was that in my over-zealousness, I changed

this line:

<script src="../avazyabadu/kramaanukrama.js" type="text/javascript"></script>

to this:

<script src="../avazyabadu/kramaanukrama.js" type="text/javascript"/>

Empty tag/element rule, you know.

So, the validator took the whole thing as JavaScript, maybe?

Lessons I learned:

  1. That JavaScript external file reference is an exception to the XHTML/XML rule. Keep the closing tag.
  2. The “space before slash” rule is no more with XHTML.
  3. Mark up fully compliant with strict XHTML validate as HTML5, provided you switch headings as below.
  4. XHTML does not need character set declaration if your page is in UTF-8
  5. Use this Validator (Not this one)

XHTML top lines:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>

HTML top lines:

<!DOCTYPE html>
<html lang="en-US">
<head>
  <meta charset="utf-8">
Sebastian Simon
  • 18,263
  • 7
  • 55
  • 75
  • About that #5 "Use This validator", actually, the regular page switches to /nu if you submit a regular HTML page. Sorry for the error. – user6545390 Jul 04 '16 at 12:23
  • If the contents are valid XHTML, the validator thinks it's alright. But the _file type_ was still HTML, so your browser uses the HTML parsing rules. – Mr Lister Jul 04 '16 at 14:20
  • If you still have the "empty" version of your file around, you can rename it to a .xhtml file extension and load in into your browser and see the difference. – Mr Lister Jul 06 '16 at 17:11