Ever wondered what HTML and XHTML is about? Long and official story can be found at W3Schools. Short story, below.

Simply put, XHTML is the same as HTML but stricter. There are rules in place that one must follow. You are no longer allowed to leave tags unclosed or place them wherever you want. And guess what, the only beneficiary from following these rules, is you, the web developer. Because your site will then be supported by most of the browsers out there; definitely more than your badly formatted HTML is today.

Quoting W3Schools, the most important differences from HTML are listed below.
Please visit W3Schools post to see examples of good vs bad code.

Document Structure

  • XHTML DOCTYPE is mandatory
  • The xmlns attribute inis mandatory
  • ,,, and <body> are **mandatory** </li> </ul> <p><strong>XHTML Elements</strong></p> <ul> <li>XHTML elements <strong>must be properly nested</strong></li> <li>XHTML elements <strong>must always be closed</strong></li> <li>XHTML elements <strong>must be in lowercase</strong></li> <li>XHTML documents <strong>must have one root element</strong></li> </ul> <p><strong>XHTML Attributes</strong></p> <ul> <li>Attribute names <strong>must be in lower case</strong></li> <li>Attribute values <strong>must be quoted</strong></li> <li>Attribute minimization is <strong>forbidden</strong></li> </ul> <p><strong>How to convert from HTML to XHTML</strong></p> <ol> <li>Add an XHTML <!DOCTYPE> to the first line of every page</li> <li>Add an xmlns attribute to the html element of every page</li> <li>Change all element names to lowercase</li> <li>Close all empty elements</li> <li>Change all attribute names to lowercase</li> <li>Quote all attribute values</li> </ol> <p>Moreover, these guys also developed a <a href="https://validator.w3.org" title="The W3C Markup Validation Service">website</a> where you can validate your page to be XHTML (and not only) compliant. They will also tell you exactly what you did wrong and how to correct. And <strong>don’t worry, it’s free</strong>! It only costs your willingness to do it the right way.</p> </div> <footer class="post-footer" data-pagefind-ignore> <ul class="post-tags"> <li><a href="https://systemmanagement.ro/tags/html/">HTML</a></li> <li><a href="https://systemmanagement.ro/tags/validator/">Validator</a></li> <li><a href="https://systemmanagement.ro/tags/w3schools/">W3Schools</a></li> <li><a href="https://systemmanagement.ro/tags/xhtml/">XHTML</a></li> </ul> <nav class="paginav"> <a class="prev" href="https://systemmanagement.ro/creating-an-e-book-part-1/"> <span class="title">« Prev</span> <span>Creating an e-book. Part 1.</span> </a> <a class="next" href="https://systemmanagement.ro/ok-e-books/"> <span class="title">Next »</span> <span>Ok, e-books</span> </a> </nav> </footer> </article> </main> <footer class="footer"> <span>© 2026 <a href="https://systemmanagement.ro/">System Management</a></span> · <a href="/privacy-policy/">Privacy Policy</a> · <a href="#" id="cookie-settings-link">Cookie settings</a> · <span> Powered by <a href="https://gohugo.io/?utm_source=papermod" rel="noopener" target="_blank">Hugo</a> & <a href="https://github.com/adityatelange/hugo-PaperMod/" rel="noopener" target="_blank">PaperMod</a> </span> </footer> <a href="#top" id="top-link" class="top-link hidden" aria-label="go to top" title="Go to Top (Alt + G)" accesskey="g"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevrons-up"> <polyline points="17 11 12 6 7 11"></polyline> <polyline points="17 18 12 13 7 18"></polyline> </svg> </a> <div id="cookie-consent" class="cookie-consent" role="region" aria-label="Cookie consent" hidden> <p class="cookie-consent__text"> This site uses Google Analytics cookies to measure anonymous traffic. They are optional and set only if you accept. See the <a href="/privacy-policy/">Privacy Policy</a>. </p> <div class="cookie-consent__actions"> <button type="button" id="cookie-decline" class="cookie-consent__btn cookie-consent__btn--ghost">Decline</button> <button type="button" id="cookie-accept" class="cookie-consent__btn">Accept</button> </div> </div> <script> (function () { var GA_ID = "G-9MNCCFKTMC"; var PROD = true ; var KEY = 'analytics-consent'; var banner = document.getElementById('cookie-consent'); function loadGA() { if (window.__gaLoaded) return; window.__gaLoaded = true; window['ga-disable-' + GA_ID] = false; if (!PROD) { console.info('[analytics] consent granted (GA not loaded in dev)'); return; } var s = document.createElement('script'); s.async = true; s.src = 'https://www.googletagmanager.com/gtag/js?id=' + GA_ID; document.head.appendChild(s); window.dataLayer = window.dataLayer || []; window.gtag = function () { dataLayer.push(arguments); }; gtag('js', new Date()); gtag('config', GA_ID); } function clearGA() { window['ga-disable-' + GA_ID] = true; document.cookie.split(';').forEach(function (c) { var name = c.split('=')[0].trim(); if (name.indexOf('_ga') === 0) { document.cookie = name + '=; Max-Age=0; path=/;'; document.cookie = name + '=; Max-Age=0; path=/; domain=' + location.hostname; } }); } function show() { if (banner) banner.hidden = false; } function hide() { if (banner) banner.hidden = true; } function decide(value) { try { localStorage.setItem(KEY, value); } catch (e) {} if (value === 'granted') loadGA(); else clearGA(); hide(); } var stored; try { stored = localStorage.getItem(KEY); } catch (e) {} if (stored === 'granted') loadGA(); else if (stored !== 'denied') show(); var a = document.getElementById('cookie-accept'); var d = document.getElementById('cookie-decline'); if (a) a.addEventListener('click', function () { decide('granted'); }); if (d) d.addEventListener('click', function () { decide('denied'); }); document.addEventListener('click', function (e) { var link = e.target.closest && e.target.closest('#cookie-settings-link'); if (link) { e.preventDefault(); show(); } }); })(); </script> <script> let menu = document.getElementById('menu'); if (menu) { const scrollPosition = localStorage.getItem("menu-scroll-position"); if (scrollPosition) { menu.scrollLeft = parseInt(scrollPosition, 10); } menu.onscroll = function () { localStorage.setItem("menu-scroll-position", menu.scrollLeft); } } document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener("click", function (e) { e.preventDefault(); var id = this.getAttribute("href").substr(1); if (!window.matchMedia('(prefers-reduced-motion: reduce)').matches) { document.querySelector(`[id='${decodeURIComponent(id)}']`).scrollIntoView({ behavior: "smooth" }); } else { document.querySelector(`[id='${decodeURIComponent(id)}']`).scrollIntoView(); } if (id === "top") { history.replaceState(null, null, " "); } else { history.pushState(null, null, `#${id}`); } }); }); </script> <script> var toplink = document.getElementById("top-link"); window.onscroll = function () { const scrollThreshold = window.innerHeight; if (document.body.scrollTop > scrollThreshold || document.documentElement.scrollTop > scrollThreshold) { toplink.classList.remove("hidden"); } else { toplink.classList.add("hidden"); } }; </script> <script> document.getElementById("theme-toggle").addEventListener("click", () => { const html = document.querySelector("html"); if (html.dataset.theme === "dark") { html.dataset.theme = 'light'; localStorage.setItem("pref-theme", 'light'); } else { html.dataset.theme = 'dark'; localStorage.setItem("pref-theme", 'dark'); } }) </script> <script> document.querySelectorAll('pre > code').forEach((codeblock) => { const container = codeblock.parentNode.parentNode; const copybutton = document.createElement('button'); copybutton.classList.add('copy-code'); copybutton.innerHTML = 'copy'; function copyingDone() { copybutton.innerHTML = 'copied!'; setTimeout(() => { copybutton.innerHTML = 'copy'; }, 2000); } copybutton.addEventListener('click', (cb) => { if ('clipboard' in navigator) { navigator.clipboard.writeText(codeblock.textContent); copyingDone(); return; } const range = document.createRange(); range.selectNodeContents(codeblock); const selection = window.getSelection(); selection.removeAllRanges(); selection.addRange(range); try { document.execCommand('copy'); copyingDone(); } catch (e) { }; selection.removeRange(range); }); if (container.classList.contains("highlight")) { container.appendChild(copybutton); } else if (container.parentNode.firstChild == container) { } else if (codeblock.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "TABLE") { codeblock.parentNode.parentNode.parentNode.parentNode.parentNode.appendChild(copybutton); } else { codeblock.parentNode.appendChild(copybutton); } }); </script> </body> </html>