Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: /> what does it mean and what does it do  (Read 3535 times)

0 Members and 1 Guest are viewing this topic.

graeme

    Topic Starter


    Newbie

    • Experience: Beginner
    • OS: Windows 10
    /> what does it mean and what does it do
    « 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
    « Last Edit: June 08, 2018, 01:53:59 PM by graeme »

    BC_Programmer


      Mastermind
    • Typing is no substitute for thinking.
    • Thanked: 1140
      • Yes
      • Yes
      • BC-Programming.com
    • Certifications: List
    • Computer: Specs
    • Experience: Beginner
    • OS: Windows 11
    Re: /> what does it mean and what does it do
    « Reply #1 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.
    I was trying to dereference Null Pointers before it was cool.

    graeme

      Topic Starter


      Newbie

      • Experience: Beginner
      • OS: Windows 10
      Re: /> what does it mean and what does it do
      « Reply #2 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