This is probably a rookie question, but I need to know what I need to know 🙂
Why do some HTML tags end with a forward slash?
For example this:
<meta name="keywords" content="bla bla bla" />
What’s that last forward slash for? What happens if I remove it?
Also some other tags have this as well… I have removed some without anything happening.
In XHTML
<foo />is shorthand for<foo></foo>. In HTML the syntax is obscure and marked as "don’t do this" as browsers don’t support it.If you are writing XHTML but pretending it is HTML (so that browsers (such as Internet Explorer 8) which don’t support XHTML can handle it), then elements defined as
EMPTYin the specification must be represented that way (and elements which are not must not).HTML 5 became a recommendation five years after this answer was written and changes the rules.