I haven’t done HTML regularly since the early 2000’s, when it was a little tougher to find good resources on coding “grammar”.
I remember using
for line breaks back then, but this course is using
for line breaks now.
What is the reasoning behind the formatting change? I’m curious if this affects other codes that you don’t need an ending tag for…like
for a horizontal rule?
<br / > is for xhtml compatibility
regular old br should work just fine
Additionally it could be argued that the xhtml version is more readable?
In HTML5 there is no difference, other than XML conformance which is not required when the document is served as
As it stands now, text/html is the de facto MIME type, and therefore the default in which case, HTML 4 becomes the core specification, and valid HTML5. There are some exceptions to this, such as deprecated or obsolete tags and attributes.
is valid, as is,
The last is the specified form in XHTML, the recommendations of which HTML5 is a refinement. To be backward compatible HTML5 needed to support both HTML 4 and XHTML. It was XHTML that demanded the
/ in self-closing tags, not HTML 4. In fact pre-XHTML the term had not even been thought of yet.
<BR> is a void element in HTML 4.
Bottom line, unless the lesson checker expects the
/, it can be left out of all tags, this especially since as stated earlier, the page is served as text/html unless otherwise specified. Further reading…
XML Conforming Markup Languages.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.