4 ms·
That's a great tutorial. One niggle: They refer to the SVG "tag." I had started HTMLing in the mid-1990s, and we always called everything "tags." Then, XHTML
by ChrisMarshallNY 3y ago
That's a great tutorial.
One niggle: They refer to the SVG "tag." I had started HTMLing in the mid-1990s, and we always called everything "tags."
Then, XHTML came in, and people started screaming at us for calling them "tags." They were elements, dammit!
I say "element," these days, but my brain still says "tag."
- padjo 3y agoAh XHTML the web’s dark age of pedantry. Call them whatever you want man, we’re much chiller in the HTML5 era.
- quickthrower2 3y agoXHTML strictness would have been a great start but at that point the "best-effort" <p><div>cat was out of the bag</span> I mean what is worse? Incorrectness, or losing ad revenue :-)
- HunorBorbely 3y agoIt's an interesting point. Writing tutorials like this also made me realize what's the difference between a function property and a function argument. I just used them completely interchangeably before. So element is more accurate here?
- ChrisMarshallNY 3y agoSVG is basically an expression of XML, and XML uses "element" for everything, so it would be more appropriate, but, TBH, I really don't think anyone reading gives a damn. I have done a ton of tutorials, myself, and have found that using vernacular, and expressing in basic, readable language, always works best. Being too pedantic can make it seem "stilted."
- dragonwriter 3y agoAFAIK, XML gets it from HTML (which was its inspiration), which got it from SGML (of which HTML was originally an application), all use "element". But, yes, SVG is an application of XML.
- Archelaos 3y agoIn XML terminology (where XHTML derives from), "tags" are the delimiters of "elements". So we have "start-tags", "end-tags", and "empty-element-tags".[1] "Element" refers to the composition of the delimiting tags and all of their (nested) content.[2] [1] https://www.w3.org/TR/xml/#sec-starttags https://www.w3.org/TR/xml/#sec-starttags [2] https://www.w3.org/TR/xml/#sec-logical-struct https://www.w3.org/TR/xml/#sec-logical-struct
- ChrisMarshallNY 3y agoThat makes great sense. I never used "tag" properly, then. But for complete elements, like <br /> or <hr />, would it be proper to refer to them as "tags"?
- d1sxeyes 3y agoDepends on what you’re talking about, to be honest. The “element” is the “thing”. The “tag” is how you tell the browser what you want. This is why you have DOM functions like “getElementsByTagName”, which allows you to say “I know the tag name is “hr” (and the tag is <hr />), but I want to get references to all the elements which are defined by that tag. As a general rule, if you’re thinking about a “thing” on a webpage, you’re think about an element. If you’re thinking about what you need to write to get that element to appear on the webpage, you’re thinking about a tag. Most of the time, folks will understand what you mean even if you use the wrong one though.
- Archelaos 3y agoIn XML, they are referred to as "empty-element tags" and are functionally equivalent to a start tag immediately followed by an end tag, such as <br></br> or <hr></hr>. If a tag has no content, it can in principle also be written as an empty-element tag, for example: </p>. However, such use is not recommended: "For interoperability, the empty-element tag SHOULD be used, and SHOULD only be used, for elements which are declared EMPTY."[1] "For interoperability" is defined as: "Marks a sentence describing a non-binding recommendation included to increase the chances that XML documents can be processed by the existing installed base of SGML processors which predate the WebSGML Adaptations Annex to ISO 8879."[2a] "SHOULD" is explicitly[2b] used as defined in RFC 2119: "This word [...] mean that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course."[3] [1] https://www.w3.org/TR/xml/#NT-EmptyElemTag https://www.w3.org/TR/xml/#NT-EmptyElemTag [2a][2b] https://www.w3.org/TR/xml/#sec-terminology https://www.w3.org/TR/xml/#sec-terminology [3] https://www.ietf.org/rfc/rfc2119.txt https://www.ietf.org/rfc/rfc2119.txt
- antod 3y agoAs others have pointed out, elements and tags are different things and always were. An element is the thing comprised of tags and the content between them. eg <tag>content</tag> is an element. https://developer.mozilla.org/en-US/docs/Glossary/Tag https://developer.mozilla.org/en-US/docs/Glossary/Tag