![]() |
Ending tags with />
Is it standard to end tags like <img>> with a />?
I'm only wondering if it's worth trying to get used to writing this way. -- -- www.gurka.se/gurka.php?x=1&language=english Tremble before the mighty Cucumber |
Re: Ending tags with />
Tim Johansson wrote:
> Is it standard to end tags like <img>> with a />? > > I'm only wondering if it's worth trying to get used to writing this way. Elements that are written like <element /> are part of XHTML. They are written like this if they are empty elements, ie. do not have a closing tag in HTML and do not contain any textual content. If you are writing regular HTML, then you don't need to do this. Only if you were using XHTML (which you obviously aren't) do you have to do it that way. HTH -- Dylan Parry http://webpageworkshop.co.uk - FREE Web tutorials and references 'I am a Bear of Very Little Brain, and long words bother me.' -- A A Milne |
Re: Ending tags with />
On Sat, 07 Aug 2004 01:58:53 +0100, Dylan Parry <usenet@dylanparry.com>
wrote: > Tim Johansson wrote: > >> Is it standard to end tags like <img>> with a />? >> >> I'm only wondering if it's worth trying to get used to writing this way. > > Elements that are written like <element /> are part of XHTML. They are > written like this if they are empty elements, ie. do not have a closing > tag in HTML and do not contain any textual content. > > If you are writing regular HTML, then you don't need to do this. Only if > you were using XHTML (which you obviously aren't) do you have to do it > that way. > > HTH > I'll add that in HTMl you don't want to do it. Using the slash in, say, a link element can lead to problems with HTML. |
Re: Ending tags with />
Dylan Parry wrote:
> Elements that are written like <element /> are part of XHTML... > If you are writing regular HTML, then you don't need to do this. It isn't optional. If you are writing regular HTML then you should not do this at all. The closing slash means something somewhat different in HTML. -- David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/> Home is where the ~/.bashrc is |
Re: Ending tags with />
David Dorward <dorward@yahoo.com> writes:
> Dylan Parry wrote: > >> Elements that are written like <element /> are part of XHTML... > >> If you are writing regular HTML, then you don't need to do this. > > It isn't optional. If you are writing regular HTML then you should not do > this at all. The closing slash means something somewhat different in HTML. Actually it is the '>' character that means something completely different in XHTML in this context. The 'closing' slash and the 'greater than' character have *nothing* to do with the EndTAGOpen delimiter '</' and the TagClose delimiter '>' respectively. In HTML, there is only one NullEndTag delimiter (the solidus) that would appear as a matching pair if the content model of the element type is *not* empty: <foo/some foo text/ or simply <foo// if there were no content at all. XML, however, uses the possibility introduced by Annex K of ISO8879 to specify a *different character* as a *start* delimiter of the NET shorthand feature, id est NetEnablingStartTagClose. And in XML, they sadistically mapped the good old NET to '>' and NESTC to the good old solidus ("it's a tag, Joe"). So, the ugly, asymmetrical, sexually frustrated <foo// larva can transform into the beautiful <foo/> butterfly (if the element instance does either not have any content or the element type's content model is EMPTY) and live happily ever after. It's a damned miracle (especially if you read all the helpful explanations at jolly good low-contrast microfont e-zines about stuff like this). -- | ) -( 111010111011 | ) |
Re: Ending tags with />
David Dorward wrote:
>> If you are writing regular HTML, then you don't need to do this. > > It isn't optional. If you are writing regular HTML then you should not do > this at all. The closing slash means something somewhat different in HTML. I guess the late night Usenetting clouded my language. What I meant by the above is that you shouldn't do it, ie. you don't need to do it because it is invalid in HTML. That'll teach me to go to bed earlier :) -- Dylan Parry http://webpageworkshop.co.uk - FREE Web tutorials and references 'I am a Bear of Very Little Brain, and long words bother me.' -- A A Milne |
| All times are GMT. The time now is 04:43 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.