{"id":46,"date":"2004-12-10T11:32:17","date_gmt":"2004-12-10T11:32:17","guid":{"rendered":"http:\/\/lachy.id.au\/log\/2004\/12\/html-tags"},"modified":"2006-04-30T23:50:45","modified_gmt":"2006-04-30T23:50:45","slug":"html-tags","status":"publish","type":"post","link":"https:\/\/lachy.id.au\/log\/2004\/12\/html-tags","title":{"rendered":"HTML Tags"},"content":{"rendered":"<p>Well, after taking a long break from writing anything on this blog,\r\n\tI&#8217;m back and better than ever. I&#8217;ll try to post more regularly from now on,\r\n\twith much better content. I hope you, my loyal readers, didn\u2019t miss me too\r\n\tmuch while I was gone, but anyway, let\u2019s get on with the good stuff. ?<\/p>\r\n\r\n<p>One thing I\u2019ve come to notice a lot of people\r\n\t\tbelieve is that in HTML, everything is a tag (or at least can be called\r\n\ta tag). This is most certainly not the case. The most recent offender I\u2019ve seen,\r\n\tand the reason I decided to write this, is the author of <a href=\"http:\/\/www.gadgetopia.com\/2004\/11\/09\/FirefoxALTTagsAndTooltips.html\">Firefox,\r\n\t\tALT Tags, and Tooltips<\/a>, which, as you can see by the title, incorrectly\r\n\t\trefers to attributes as tags. The article itself is quite good, and I\r\n\t\tfully agree with its message about tooltips for alt attributes, it\u2019s just the\r\n\t\tincorrect references to the attributes as tags that bugs me. This author is\r\n\t\tnot the first, nor the last to make the mistake, but it is about time people\r\n\t\tlearn to call things by their real names.<\/p>\r\n<p>If you read part 5, Terminology, of <a href=\"http:\/\/www.flightlab.com\/%7Ejoe\/\">Joe\r\n\t\tEnglish<\/a>\u2019s humorous document: \u201c<a href=\"http:\/\/www.flightlab.com\/%7Ejoe\/sgml\/faq-not.txt\">Not\r\n\tthe comp.text.sgml Frequently Asked Questions List<\/a>\u201d, you will see the common\r\n\tname for everything except a tag, is a <em>tag<\/em>. The common name for a tag being\r\n\ta command, which, of course, <em>makes perfect sense<\/em>! ?<\/p>\r\n\r\n<blockquote>\r\n\t<pre>    --------------------------------------------------\r\n    ISO\/W3C terminology\t\t\tCommon name\r\n    --------------------------------------------------\r\n    attribute\t\t\t\ttag\r\n    attribute value\t\t\ttag\r\n    attribute value literal\t\ttag\r\n    attribute value specification\ttag\r\n    character reference\t\t\ttag\r\n    comment\t\t\t\ttag\r\n    comment declaration \t\ttag\r\n    declaration\t\t\t\ttag\r\n    document type declaration\t\ttag\r\n    document type definition\t\ttag\r\n    element\t\t\t\ttag\r\n    element type\t\t\ttag\r\n    element type name\t\t\ttag\r\n    entity\t\t\t\ttag\r\n    entity reference\t\t\ttag\r\n    general entity\t\t\ttag\r\n    generic identifier\t\t\ttag\r\n    literal\t\t\t\ttag\r\n    numeric character reference\t\ttag\r\n    parameter entity\t\t\ttag\r\n    parameter literal\t\t\ttag\r\n    processing instruction\t\ttag\r\n    tag\t\t\t\t\tcommand\r\n    --------------------------------------------------\r\n<\/pre>\r\n<\/blockquote>\r\n<p>So what exactly is a tag then?  Well, before I get to that, I\u2019ll just explain\r\n\twhat some of the more common SGML and XML terminology means and what a tag\r\n\tis not.<\/p>\r\n\r\n<p>Firstly, tags are not commands.  People believe they are commands because\r\n\tof the misconception that HTML is a presentational language, or even a programming\r\n\tlanguage. <a href=\"http:\/\/www.cs.tut.fi\/%7Ejkorpela\/prog.html\">HTML is certainly\r\n\tnot a programming language<\/a>, and while it is true\r\n\tthat presentational features have crept in, they have already been deprecated\r\n\tand\/or removed (X)HTML, or at least will be in future versions.<\/p>\r\n\r\n<p>It is the presentational elements and attributes that could be seen as commands\r\n\tor instructions to display the content in a certain way; however, they are\r\n\tin fact suggestions, just like CSS properties \u2013 the only difference being\r\n\tthat these presentational suggestions are mixed in with the markup, and have\r\n\tno real semantics that indicate what the content is, only what the author\r\n\twants it to look like, usually in a visual medium. Any presentational feature,\r\n\twhether done with CSS or the presentational elements and attributes, can\r\n\tbe overridden by a user with a user stylesheet (assuming the user agent supports\r\n\tthat facility), therefore, they are only suggestions that a user does not\r\n\thave to accept, not commands that a user agent, nor user must obey.<\/p>\r\n\r\n<p>HTML, since it has been formally based on SGML, is intended to mark up the\r\n\tstructure and semantics of the content by saying what it is, not what it\r\n\tdoes, nor how it looks (with the exception of the afore mentioned presentational\r\n\tfeatures). Basically, HTML is not a procedural programming language; it is\r\n\ta descriptive markup language, so tags are not commands.<\/p>\r\n\r\n<h5>Attribute Tags<\/h5>\r\n<p>There\u2019s no excuse for calling attributes tags, other than complete laziness\r\n\tand\/or ignorance, but as already shown, calling attributes tags is a common\r\n\tmistake. An attribute is a property of an element that is written within\r\n\tthe start-tag of an element, and should be referred to as simply an attribute.\r\n\teg. <q>The <code>alt<\/code> attribute\u2026<\/q> is\r\n\tthe simplest way of referring to an attribute, and is only slightly longer\r\n\tthan writing tag. However, a shorthand method of referring to attributes, which\r\n\tI occasionally see within plain text e-mails, is to write it within vertical\r\n\tbars, or some other delimiter. eg. <kbd>|alt|<\/kbd>.<\/p>\r\n\r\n<h5>Character Tags (or Entities)<\/h5>\r\n<p>Character references are sometimes called tags, but are more often called\r\n\tentities. Just like attributes, they are  not tags either, but what\u2019s\r\n\twrong with calling them entities?<\/p>\r\n\r\n<p>According the <a href=\"http:\/\/www.w3.org\/TR\/html401\/intro\/sgmltut.html#h-3.2.3\">section\r\n\t\t3.2.3 of the HTML 4.01 recommendation<\/a>, <q cite=\"http:\/\/www.w3.org\/TR\/html401\/intro\/sgmltut.html#h-3.2.3\">Character\r\n\treferences are numeric or symbolic names for characters that may be included\r\n\tin an HTML document<\/q>. <a href=\"http:\/\/www.w3.org\/TR\/html401\/charset.html#h-5.3\">Section\r\n\t5.3<\/a> also states:<\/p>\r\n\r\n<blockquote>\r\n\t<p>Character references in HTML may appear in two forms:<\/p>\r\n\t<ul>\r\n\t\t<li>Numeric character references (either decimal or hexadecimal).<\/li>\r\n\t\t<li>Character entity references.<\/li>\r\n\t<\/ul>\r\n<\/blockquote>\r\n\r\n<p>The numeric character references take the form <code>&amp;#<var>nnnn<\/var>;<\/code> (decimal)\r\n\tor <code>&amp;#x<var>nnnn<\/var>;<\/code> (hex).  Character entity references\r\n\tare the named entities for the <a href=\"http:\/\/www.w3.org\/TR\/html401\/sgml\/entities.html#h-24.2\">ISO-8859-1\r\n\tcharacters<\/a> (from 160 to 255), <a href=\"http:\/\/www.w3.org\/TR\/html401\/sgml\/entities.html#h-24.3\">symbols,\r\n\tmathematical symbols and Greek letters<\/a>, and finally, <a href=\"http:\/\/www.w3.org\/TR\/html401\/sgml\/entities.html#h-24.4\">markup-significant\r\n\tand internationalization characters<\/a>.<\/p>\r\n\r\n<p>Based on that, you may think that it is only the numeric references that are\r\n\tincorrectly referred to as entities; however, it is indeed both forms. In SGML\r\n\tand XML there are several <a href=\"http:\/\/www.is-thought.co.uk\/book\/sgml-6.htm#Types\">types\r\n\tof entities<\/a>, and the simplest explanation of\r\n\twhat an entity is, is that which comes from ISO-8879 itself, the SGML specification:\r\n\tan entity is <q>a collection of characters that can be referenced as a unit<\/q>.\r\n\tThe purpose of entities can be easily understood, but understanding exactly\r\nwhat an entity is and separating that concept from the markup, is more difficult.<\/p>\r\n\r\n<p>An entity is a concept that is defined in a DTD using an <a href=\"http:\/\/www.is-thought.co.uk\/book\/sgml-6.htm#ENTITY\">entity\r\n\t\tdeclaration<\/a>\tdefining both the name, and the replacement text. The entities are referred\r\n\tto within a document using an <a href=\"http:\/\/www.is-thought.co.uk\/book\/sgml-6.htm#references\">entity\r\n\treference<\/a> in the form: <code>&amp;<var>name<\/var>;<\/code>.\r\n\tThe entity declaration and the entity reference are just the markup for the\r\n\tentity, but they are not the entity itself.<\/p>\r\n\r\n<p>Generally, when people say entities in regard to an HTML document, they are\r\n\tactually referring to the character entity references and\/or the numeric\r\n\tcharacter references; not the entity itself. Though, this is not always the\r\n\tcase, SGML and XML experts will usually get it right, but luckily, the intended\r\n\tmeaning of the speaker can generally be understood from the context of its\r\n\tuse.<\/p>\r\n\r\n<h5> The DOCTYPE Tag <\/h5>\r\n<p>The Document Type Declaration, or simply DOCTYPE, is often referred to as\r\n\tthe DTD, or the <code>DOCTYPE<\/code> tag.  The acronym, <abbr title=\"Document Type Definition\">DTD<\/abbr>, can be mistakenly\r\n\tused to refer to the Document Type Declaration, since it has the same initials\r\nas the acronym\u2019s defined meaning: Document Type Definition.<\/p>\r\n\r\n<p>The DOCTYPE is not a tag either, it is a declartion, so calling it the <code>DOCTYPE<\/code> tag\r\n\tis incorrect. However, more often than not, is easier to simply refer to it\r\n\tas just the <code>DOCTYPE<\/code>.<\/p>\r\n\r\n<h5>The &lt;?xml?&gt; Tag <\/h5>\r\n<p>The XML declaration, often referred to as a Processing Instruction or Prolog,\r\n\tis also sometimes called the &lt;?xml?&gt; tag. As you can probably guess, it\r\n\tis not a tag. It is also not a processing instruction either, but that, at\r\n\tleast, is forgivable, since it does have the appearance of an XML PI, though\r\n\tit is\r\n\t<a href=\"http:\/\/www.w3.org\/TR\/REC-xml\/#dt-xmldecl\">defined separately as the\r\n\tXML Declaration<\/a>. It is <a href=\"http:\/\/annevankesteren.nl\/archives\/2004\/08\/xml-declaration\">not\r\n\tthe prolog<\/a> either, but it is part of the prolog.<\/p>\r\n\r\n<h5>Elements and Tags <\/h5>\r\n<p>An element is not a tag, as noted at the end of <a href=\"http:\/\/www.w3.org\/TR\/html401\/intro\/sgmltut.html#h-3.2.1\">section <cite>3.2.1\r\n\t\t\tElements<\/cite><\/a>, in the HTML 4.01 recommendation:<\/p>\r\n\r\n<blockquote>\r\n\t<p class=\"note\"><strong>Elements are not tags.<\/strong> Some people refer to\r\n\t\telements as tags (e.g., &#8220;the P tag&#8221;). Remember that the element is one thing,\r\n\t\tand the tag (be it start or end tag) is another. For instance, the HEAD element\r\n\t\tis always present, even though both start and end HEAD tags may be missing\r\n\t\tin the markup<\/p>\r\n<\/blockquote>\r\n\r\n<p>Tag only refers to either the start- or end-tags.  Every element has a start-tag\r\n\t(eg. <code>&lt;p&gt;<\/code>) and, with the exception of empty elements, an end-tag\r\n\t(eg. <code>&lt;\/p&gt;<\/code>).  Empty elements never have an end-tag in HTML,\r\n\tthough one is required in XML, and thus XHTML (which can use the special\r\n\tempty element tag syntax). As noted, in HTML, the start- or end-tags may\r\n\tbe omitted for some elements, but those elements are still present.<\/p>\r\n\r\n<p>An element is more of a concept that is defined using an element declaration,\r\n\tand comprises an element name, that appears within the start- and end-tags,\r\n\tany attributes within the start-tag, and (with the exception of empty elements)\r\n\tits content model and finally, its content. An element is included in a document\r\n\tby writing its start and end tags, as needed, but (like entity declarations\r\n\tand references) the element declaration and tags are only the markup for\r\n\tan element; they are not the element itself. It is important that this distinction\r\n\tbe made and understood by authors \u2013 I just hope I\u2019ve explained it well enough.<\/p>\r\n","protected":false},"excerpt":{"rendered":"Well, after taking a long break from writing anything on this blog, I&#8217;m back and better than ever. I&#8217;ll try to post more regularly from now on, with much better content. I hope you, my loyal readers, didn\u2019t miss me too much while I was gone, but anyway, let\u2019s get on with the good stuff. &hellip; <a href=\"https:\/\/lachy.id.au\/log\/2004\/12\/html-tags\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">HTML Tags<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2,7],"tags":[],"_links":{"self":[{"href":"https:\/\/lachy.id.au\/log\/wp-json\/wp\/v2\/posts\/46"}],"collection":[{"href":"https:\/\/lachy.id.au\/log\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lachy.id.au\/log\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lachy.id.au\/log\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lachy.id.au\/log\/wp-json\/wp\/v2\/comments?post=46"}],"version-history":[{"count":0,"href":"https:\/\/lachy.id.au\/log\/wp-json\/wp\/v2\/posts\/46\/revisions"}],"wp:attachment":[{"href":"https:\/\/lachy.id.au\/log\/wp-json\/wp\/v2\/media?parent=46"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lachy.id.au\/log\/wp-json\/wp\/v2\/categories?post=46"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lachy.id.au\/log\/wp-json\/wp\/v2\/tags?post=46"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}