yandoo Posted December 16, 2012 Share Posted December 16, 2012 (edited) Hi there I have wondered something about html for ages and hope you could answer it for me. Ive noticed in html some tages close with a / and others dontg, yet they produce the same result.. For example with tags on META data: <META name"description" content="text of stuff and things"> <META name"description" content="text of stuff and things"/> Another example is the br tag: <br> <br/> Whats the best method for the closing tag? The / or not the slash? Thank you for elevating me to a new sense of awareness Edited December 16, 2012 by yandoo Quote Link to comment Share on other sites More sharing options...
Christian F. Posted December 16, 2012 Share Posted December 16, 2012 This is one of the differences between using HTML and XHTML. While self-closing tags are optional in HTML, they're required in XHTML. If you're using HTML it's up to you, but it is considered best practise to close all of your HTML tags still. Quote Link to comment Share on other sites More sharing options...
yandoo Posted December 16, 2012 Author Share Posted December 16, 2012 Thank you for the information and merry christmas Quote Link to comment Share on other sites More sharing options...
DavidAM Posted December 16, 2012 Share Posted December 16, 2012 This is one of the differences between using HTML and XHTML. While self-closing tags are optional in HTML, they're required in XHTML. If you're using HTML it's up to you, but it is considered best practise to close all of your HTML tags still. In HTML 4.01 Strict, the W3C Validation Service will produce warnings and errors if the "self-closing" tag is used. This style is defined for XHTML and HTML5 Quote Link to comment Share on other sites More sharing options...
Christian F. Posted December 17, 2012 Share Posted December 17, 2012 Hmm... Seems my memory played a trick on me there, been too long since I read the TR. Thanks for correcting me, DavidAM. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.