Is this code okay, where I ID a close div:
<html>
<body>
<div id="main">
</div id=main">
</body>
</html>
No. The id attribute should only be in the opening tag.
If you're doing this for readability, you might want to use HTML comments and tabified source:
<html>
<body>
<div id="main">
</div>
<!-- close main div -->
</body>
</html>
It's invalid: The validator will output
Line x, Column y: End tag had attributes.
If you want to do this to avoid confusion from multiple closing tags, just use a comment to clarify which tag belongs to which element:
</div> <!-- #main -->
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