Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   HTML (http://www.velocityreviews.com/forums/f31-html.html)
-   -   Ending tags with /> (http://www.velocityreviews.com/forums/t158986-ending-tags-with.html)

Tim Johansson 08-07-2004 12:49 AM

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



Dylan Parry 08-07-2004 12:58 AM

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

Neal 08-07-2004 04:48 AM

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 &lt;img&gt;> with a /&gt;?
>>
>> 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.


David Dorward 08-07-2004 07:16 AM

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

Eric B. Bednarz 08-07-2004 10:58 AM

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
| )

Dylan Parry 08-07-2004 12:35 PM

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.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57