There are many people that mark closing tags like this to help identify the closing tag that goes with an HTML tag:
<div id="header"> <div id="logo"> <a href="index.php"> <img id="logoimg" src="images/as_logo.png" alt="Logo" border="0" /> </a> </div> <!-- logo --> </div> <!-- header -->
I was wondering if it is syntactically ok to do this:
<div id="header"> <div id="logo"> <a href="index.php"> <img id="logoimg" src="images/as_logo.png" alt="Logo" border="0" /> </a> </div id="logo"> </div id="header">
UPDATE: Here is the text from the spec on HTML5.3:
8.1.2.2. End tags
End tags must have the following format:
8.1.2.3. Attributes
Attributes for an element are expressed inside the element’s start tag.
Note that attributes are only allowed on START TAGS.
using @jbyrds idea; using the HR tag allows you to see if you forgot the z attribute:
<div id="header"> <div id="logo"> <a href="index.php" id=link"> <img id="logoimg" src="images/as_logo.png" alt="Logo" border="0" /> </a><hr z="link"> </div><hr z="logo"> </div><hr z="header">
Although this adds more text, 32 extra characters vs. the original or the tags having a hidden class, you can use CSS to hide them.
[z] { display: none; }
Attribute Name and Values HTML attributes consist of a name and a value using the following syntax: name="value" and can be added to the opening tag of an HTML element to configure or change the behavior of the element.
Tags can also have attributes, which are extra bits of information. Attributes appear inside the opening tag and their values sit inside quotation marks.
The '/' (forward slash) is used to represent the closing of a tag in HTML.
HTML attributes generally come in name-value pairs, and always go in the opening tag of an element.
Short answer, No.
Use the comments instead.
The answer is no for most tags. However, you could argue that tags like "img" that can be self-closing, are able to have attributes in them. But these self-closing tags are taking the place of an opening tag and a closing tag, so it's not the same as having an attribute in a closing tag. To be honest, there is really no need for this, it would just create more for the browser to have to read and make the page size bigger.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With