Forum Moderators: open
Also on META tags some people use a trailing slash in the META tags
<meta name="base" href="ht*p://w*w.example.com/widgets.htm" />
what is up with the single quotes and the trailing slash?
XHTML requires all <tag>'s to end with a </tag>. If there is no enclosed data than a trailing " />" can be used. Thus <br> becomes <br />, <hr> becomes <hr /> and <image ...> becomes <image ... />, the </p> is mandatory, etc.
what about mixing them?
Technically it's no problem as long as you are using the same quotes for the beginning and ending a value: ie. not "value', just "value" or 'value'. It is best practice to keep a consistent coding style, but that's about it. You should not, however, use trailing slashes (such as
<br [b]/[/b]> in HTML documents, only in XHTML documents.
<p>some text
<p>more text
But in XHTML (which is really just "HTML 5") you must write:
<p>some text</p>
<p>more text</p>
That leaves us with a puzzle when considering those elements which have no content, such as <img> and <meta>. You *must* close them (under the XHTML rules). You can write <img></img> or <meta></meta> if you wish, but the short form is to close them with /> like this:
<img />
<meta />