Content deleted Content added
m Elements: Using "<br />" confuses readers into believing " /" is needed for this element. It's been discouraged by both the W3C and the WHATWG to use br in such a way. The WHATWG spec only references <br>, not <br />.
SGML-based versus XML-based HTML: Same note as previous edit.
Line 406:
Like HTML 4.01, XHTML 1.0 has three sub-specifications: strict, transitional, and frameset.
 
Aside from the different opening declarations for a document, the differences between an HTML 4.01 and XHTML 1.0 document—in each of the corresponding DTDs—are largely syntactic. The underlying syntax of HTML allows many shortcuts that XHTML does not, such as elements with optional opening or closing tags, and even empty elements which must not have an end tag. By contrast, XHTML requires all elements to have an opening tag and a closing tag. XHTML, however, also introduces a new shortcut: an XHTML tag may be opened and closed within the same tag, by including a slash before the end of the tag like this: {{code|lang=html|code=<br/>}}. The introduction of this shorthand, which is not used in the SGML declaration for HTML 4.01, may confuse earlier software unfamiliar with this new convention. A fix for this is toremove includethe aslash spacepreceding beforethe closing theangle tagbracket, as such: {{code|lang=html|code=<br />}}.<ref>Freeman,{{cite|title=HTML EStandard (2005).- HeadThe Firstbr HTMLElement|url=https://html. O'Reillyspec.whatwg.org/multipage/text-level-semantics.html#the-br-element|publisher=WHATWG}}</ref>
 
To understand the subtle differences between HTML and XHTML, consider the transformation of a valid and well-formed XHTML 1.0 document that adheres to Appendix C (see below) into a valid HTML 4.01 document. Making this translation requires the following steps:
Line 414:
# If present, '''remove the XML declaration.''' (Typically this is: {{code|lang=xml|code=<?xml version="1.0" encoding="utf-8"?>}}).
# '''Ensure that the document's MIME type is set to <code>text/html</code>.''' For both HTML and XHTML, this comes from the HTTP <code>Content-Type</code> header sent by the server.
# '''Change the XML empty-element syntax to an HTML style empty element''' ({{code|lang=html|code=<br/>}} to {{code|lang=html|code=<br />}}).
 
Those are the main changes necessary to translate a document from XHTML 1.0 to HTML 4.01. To translate from HTML to XHTML would also require the addition of any omitted opening or closing tags. Whether coding in HTML or XHTML it may just be best to always include the optional tags within an HTML document rather than remembering which tags can be omitted.
Line 423:
* Include both <code>xml:lang</code> and <code>lang</code> attributes on any elements assigning language.
* Use the empty-element syntax only for elements specified as empty in HTML.
* IncludeRemove anthe extraclosing spaceslash in empty-element tags: for example {{code|lang=html|code=<br />}} instead of {{code|lang=html|code=<br/>}}.
* Include explicit close tags for elements that permit content but are left empty (for example, {{code|lang=html|code=<div></div>}}, not {{code|lang=html|code=<div />}}).
* Omit the XML declaration.