Computer Hope

Software => Internet browsers => Topic started by: graeme on June 08, 2018, 01:17:12 PM

Title: /> what does it mean and what does it do
Post by: graeme on June 08, 2018, 01:17:12 PM
I'm trying to figure out what a piece of computer code in my html file is and what it does. Can someone help me.

In a copied coded piece of info for a <Link>. I have the end of statement line " /> " . Why does the end statement be written as /> when everywhere else it is simply >

Is this short hand for in closing statement instruction. If the <link> is not closed by something following it i.e. <link    rel="" >test</link>. If so why as I do not understand. Is it necessary? guidance would be appreciated.

I feel very silly asking as it sounds like why a full stop

Similarly in meta statements do I need to end with />

I copied for example the Bing statement for how to track my website and they have a no /. in the code. Do I need to add the full stop?

help please.
Graeme
Title: Re: /> what does it mean and what does it do
Post by: BC_Programmer on June 08, 2018, 09:02:51 PM
 /> at the end of a tag indicates that it is not "opening" a tag. It's something that was breought in from XML to help standardize the HTML markup. Otherwise, anything interpreting the HTML needs to know which tags can have contents and which cannot.

There is nothing useful that can be put "inside" a <link> tag- you only want to set attributes on the tag itself, so the tag ends with /> as shorthand for <link rel="whatever"></link>. Previously, they just never had a closing tag at all- you would have <link rel="whatever"> and the browser was expected to know that <link> tags don't need to be closed.
Title: Re: /> what does it mean and what does it do
Post by: graeme on June 09, 2018, 03:07:05 AM
Thank you BC_Programmer. Much appreciated.

So good practice is to close. The same appears to happen with Meta tags.

Graeme