I think there are different style guides for each. I don’t understand why you put them together. We were talking about a HTML guide style, not about having one for both of the coding languages. Though I can understand you and agree with you on the practical aspect, my observation wasn’t on what’s the best way to code, but regarding how a style guide should be. As mrf said, we should look for objective directions. You cannot be subjective with the minimum requirement. The fact that different files types (HTML and XML) have different minimum requirements is not subjective. The point wasn’t to create a universal style guide for all the coding languages but a style guide for each one of them separately. Having this in mind you cannot be subjective by following the minimum requirement for each coding language. The fact that you want to have a common coding style for both coding languages is subjective.
I understand that you want to make users happy but that’s exactly what subjectivity is. A style guide purpose is not to make users happy but to guide them. What you consider to make the users happy may be good, indeed, and I don’t disagree with what you consider to be good. My objection was on the subjective-objective matter, not regarding which is the best way to code.
bit43…, I agree with you. Even though mtf and nemo242 may have annoyed each other (I don’t know if that was the case), their debate really made clear some aspects of HTML that would have been hard to clarify well in a simple statement.
The forward slash is a convention inherited from XHTML which is strongly conformant with XML. In XML there are no void elements so when the recommendations for XHTML were devised in the late 90s it was decided that void tags would end with a /.
and so on. The original spec didn’t have a space but for some odd reason IE5.2 for the Mac was choking on that syntax. Someone discovered that it could handle it if there was a space.
Today, HTML5 has two flavors that it can be served out as. Plain text or XML application. Most of what we are doing is using the MIME type="text/html" so the slash is not needed. However when serving as XML the slash is needed. The space is not, but if it is there, it is ignored.
I appreciate this explanation, as it is making me pause to consider what you are explaining and reflect on my original observation and questions. You are a wealth of knowledge and always find your posts helpful. I just want to clarify that I am understanding.
In the course, I just completed the introduction to HTML section about basic elements, and noted that the image tag is a self-closing tag. This would explain why the forward slash is paired with the closing bracket of the single tag in your first example. Apparently the input tag is also a self-closing tag.
I have noticed that all the slashes for the closing tags In the Codecademy examples come before the text in the closing element. Like the paragraph tag,
or the button tag
It is possible then that the examples that caught my attention within the discussion board comments were void tags, or self-closing tags, or other tags I have not yet learned that don’t follow the format of a tag with a closing element such as the paragraph tag, but with my limited tag knowledge thought they might be just another accepted order of writing a closing element of a tag. (Of course, I don’t recall all the discussions where I saw them, but will examine future examples that don’t follow the expected order and see what I learn).
Void tags (self-closing tags in XHTML) have no content, hence they do not need a closing tag. Everything of import is in the element attributes.
Elements that are containers need a closing tag. They are usually categorized as sectioning elements. They may contain other HTML, or plain text. The paragraph above is a good example, mind we don’t enclose many HTML elements, mostly text and other inline elements such as <span></span>, <img>, etc. The <button></button> element contains plain text, only, in most cases.
There are only a handful of void elements. Check W3C for HTML Elements to get a complete rundown of the differing purposes. Pay close attention to what content is allowed, as well as what attributes are allowed.