</A> not needed?

Discussion in 'HTML' started by Samuël van Laere, Jun 25, 2006.

  1. I've allway's thought this was correct:
    <ul>
    <li><a href=http://www.someurltoadd.com>Click Me</a></li>
    </ul>

    But it isn't.

    The W3C HTML Validator doesn't want the ending </a> tag there.
    Why is that?
    I mean, it looks better with right?

    Cheers,
    Sam
     
    Samuël van Laere, Jun 25, 2006
    #1
    1. Advertising

  2. Samuël van Laere

    mbstevens Guest

    On Sun, 25 Jun 2006 01:56:50 +0200, Samuël van Laere wrote:

    > I've allway's thought this was correct:
    > <ul>
    > <li><a href=http://www.someurltoadd.com>Click Me</a></li>
    > </ul>
    >
    > But it isn't.
    >
    > The W3C HTML Validator doesn't want the ending </a> tag there.
    > Why is that?
    > I mean, it looks better with right?


    There is a server error on that address,
    so I can't look at the source. But you are
    probably not using a doc type that uses a closing tag.
    Go to w3c org and read about doc types.
     
    mbstevens, Jun 25, 2006
    #2
    1. Advertising

  3. > There is a server error on that address,
    > so I can't look at the source. But you are
    > probably not using a doc type that uses a closing tag.
    > Go to w3c org and read about doc types.
    >
    >


    The address is:
    http://www.oukje.nl/
    Everything validates, includes a doctype and everything.

    Any thoughts?

    Cheers,
    Sam
     
    Samuël van Laere, Jun 25, 2006
    #3
  4. "mbstevens" <> schreef in bericht
    news:p...
    > There is a server error on that address,
    > so I can't look at the source. But you are
    > probably not using a doc type that uses a closing tag.
    > Go to w3c org and read about doc types.



    Its wierd.
    When I add the closing href tag </a> the validator
    won't validate the website succesfull.
    And without it, it will.
    Could it be because of UTF8?

    Cheers,
    Sam
     
    Samuël van Laere, Jun 25, 2006
    #4
  5. Samuël van Laere wrote:
    >> There is a server error on that address,
    >> so I can't look at the source. But you are
    >> probably not using a doc type that uses a closing tag.
    >> Go to w3c org and read about doc types.
    >>
    >>

    >
    > The address is:
    > http://www.oukje.nl/
    > Everything validates, includes a doctype and everything.
    >
    > Any thoughts?


    Bug. Not the first time. The closing tag is not optional see:

    http://www.w3.org/TR/html4/struct/links.html#edef-A

    "Start tag: required, End tag: required"


    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Jun 25, 2006
    #5
  6. Samuël van Laere

    dorayme Guest

    In article <c6623$449dd136$d52e1f47$>,
    "Samuël van Laere" <> wrote:

    > I've allway's thought this was correct:
    > <ul>
    > <li><a href=http://www.someurltoadd.com>Click Me</a></li>
    > </ul>
    >
    > But it isn't.
    >
    > The W3C HTML Validator doesn't want the ending </a> tag there.
    > Why is that?
    > I mean, it looks better with right?
    >
    > Cheers,
    > Sam


    You need the closing, also, put " " around the url...

    --
    dorayme
     
    dorayme, Jun 25, 2006
    #6
  7. Samuël van Laere

    mbstevens Guest

    On Sat, 24 Jun 2006 20:24:24 -0400, Jonathan N. Little wrote:

    > Samuël van Laere wrote:
    >>> There is a server error on that address,
    >>> so I can't look at the source. But you are
    >>> probably not using a doc type that uses a closing tag.
    >>> Go to w3c org and read about doc types.
    >>>
    >>>

    >>
    >> The address is:
    >> http://www.oukje.nl/
    >> Everything validates, includes a doctype and everything.
    >>
    >> Any thoughts?

    >
    > Bug. Not the first time. The closing tag is not optional see:
    >
    > http://www.w3.org/TR/html4/struct/links.html#edef-A
    >
    > "Start tag: required, End tag: required"


    Yes, I think you're right. The validator is claiming there was no <a...>
    tag. There is an empty <a></a> pair above the first error link that may
    have caused the validator to make a mistake, I don't know.

    I would advise the op to
    indent the markup in a readable way (no 500+ character lines!). This seems
    to be my pet peeve today, but why would one post markup to a group that
    places entire <ul>....</ul> blocks on a single line? Are we expected to
    read this stuff? The rest of the page is formatted for human readers. Why
    not at least get the line with the error on it humanly readable before
    posting? It might just clear up the problem.
     
    mbstevens, Jun 25, 2006
    #7
  8. Gazing into my crystal ball I observed "Samuël van Laere"
    <> writing in news:c6623$449dd136$d52e1f47$27874
    @news.chello.nl:

    > I've allway's thought this was correct:
    ><ul>
    ><li><a href=http://www.someurltoadd.com>Click Me</a></li>
    ></ul>
    >
    > But it isn't.
    >
    > The W3C HTML Validator doesn't want the ending </a> tag there.
    > Why is that?
    > I mean, it looks better with right?
    >


    Here's the error:
    <a href=http://www.oukje.nl/weblog/index.php?id=4
    The validator is looking for <a href=" , so it thinks that the A element
    is not open, therefore </a> is throwing an error.



    --
    Adrienne Boswell at Home
    Arbpen Web Site Design Services
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne Boswell, Jun 25, 2006
    #8
  9. Samuël van Laere

    Brian Cryer Guest

    "Adrienne Boswell" <> wrote in message
    news:Xns97ECB6736F989arbpenyahoocom@69.28.186.121...
    > Gazing into my crystal ball I observed "Samuël van Laere"
    > <> writing in news:c6623$449dd136$d52e1f47$27874
    > @news.chello.nl:
    >
    >> I've allway's thought this was correct:
    >><ul>
    >><li><a href=http://www.someurltoadd.com>Click Me</a></li>
    >></ul>
    >>
    >> But it isn't.
    >>
    >> The W3C HTML Validator doesn't want the ending </a> tag there.
    >> Why is that?
    >> I mean, it looks better with right?
    >>

    >
    > Here's the error:
    > <a href=http://www.oukje.nl/weblog/index.php?id=4
    > The validator is looking for <a href=" , so it thinks that the A element
    > is not open, therefore </a> is throwing an error.


    Adrienne is quite right - always put quotes around the address, so:
    <a href="http://www.someurltoadd.com">Click Me</a>
    and NOT:
    <a href=http://www.someurltoadd.com>Click Me</a>
    --
    Brian Cryer
    www.cryer.co.uk/brian
     
    Brian Cryer, Jun 25, 2006
    #9
  10. Samuël van Laere wrote:

    > <li><a href=http://www.someurltoadd.com>Click Me</a></li>


    > The W3C HTML Validator doesn't want the ending </a> tag there.
    > Why is that?


    It is an oddity of SGML. Even though browsers don't generally support it,
    the first slash character in the URL ends the tag, and the second ends the
    element.

    What you have there is, IIRC, the same as:

    <li><a href="http:"></a>www.someurltoadd.com&gt;Click Me</a></li>

    If an attribute consists only of certain characters, then quotes are
    optional, but its easier not to try to remember those excepts and simply
    work to the rule "Always quote attribute values".

    http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
     
    David Dorward, Jun 25, 2006
    #10
  11. Samuël van Laere

    Neredbojias Guest

    To further the education of mankind, Adrienne Boswell <>
    vouchsafed:

    > Gazing into my crystal ball I observed "Samuël van Laere"
    > <> writing in news:c6623$449dd136$d52e1f47$27874
    > @news.chello.nl:
    >
    >> I've allway's thought this was correct:
    >><ul>
    >><li><a href=http://www.someurltoadd.com>Click Me</a></li>
    >></ul>
    >>
    >> But it isn't.
    >>
    >> The W3C HTML Validator doesn't want the ending </a> tag there.
    >> Why is that?
    >> I mean, it looks better with right?
    >>

    >
    > Here's the error:
    > <a href=http://www.oukje.nl/weblog/index.php?id=4
    > The validator is looking for <a href=" , so it thinks that the A element
    > is not open, therefore </a> is throwing an error.


    That's certain. I copied the whole page, added the quotes, and validated
    by direct input (paste). -No error.

    --
    Neredbojias
    Infinity has its limits.
     
    Neredbojias, Jun 25, 2006
    #11
  12. Samuël van Laere

    Toby Inkster Guest

    Jonathan N. Little wrote:

    > Bug. Not the first time.


    It's not a bug. For HTML the W3C validator is virtually bug-free. It has
    one or two limitations when dealing with XML, but that's about it.

    As David Dorwood pointed out,

    <a href=http://example.org/>Example</a>

    is actually *invalid*, but

    <a href=http://example.org/>Example

    is (perhaps surprisingly) *valid*! But neither means what you think it
    might mean. The reason for this is SGML's "SHORTTAG" feature which allows
    for a few odd-looking shorthands for common contructs. For example:

    <b/Text/

    is shorthand for:

    <b>Text</b>

    Similarly:

    <a href=http://example.org/>Example</a>

    is shorthand for:

    <a href="http:"></a>example.org/&gt;Example</a>

    And note now that you have two closing "</a>" tags, which is why it's
    invalid.

    The rule to take away from this is to quote attribute values. That is:

    <a href="http://example.org/">Example</a>

    which will mean exactly what you expect it to mean. There are occasions
    when it's OK in HTML to leave out the quote marks, but it's never harmful
    to include them; so if you're unsure, always include the quote marks.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Jun 25, 2006
    #12
  13. In article <5n.co.uk>,
    Toby Inkster <> wrote:

    > which will mean exactly what you expect it to mean. There are occasions
    > when it's OK in HTML to leave out the quote marks, but it's never harmful
    > to include them; so if you're unsure, always include the quote marks.


    How about making it a personal rule to always quote attribute values
    instead of guessing what one could get away with. I'm pretty sure I know
    what I can get away with, but I always quote attributes values.
    I think that's a logical two cents or two pence

    leo

    --
    <http://web0.greatbasin.net/~leo/>
     
    Leonard Blaisdell, Jun 26, 2006
    #13
  14. Toby Inkster wrote:

    > As David Dorwood pointed out,


    Who? :)
     
    David Dorward, Jun 26, 2006
    #14
  15. Samuël van Laere

    Mark Parnell Guest

    Deciding to do something for the good of humanity, David Dorward
    <> declared in alt.html:

    > Toby Inkster wrote:
    >
    >> As David Dorwood pointed out,

    >
    > Who? :)


    "Think I better knock, knock, knock on wood..."

    *gets coat*

    --
    Mark Parnell
    My Usenet is improved; yours could be too:
    http://blinkynet.net/comp/uip5.html
     
    Mark Parnell, Jun 26, 2006
    #15
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. greg
    Replies:
    0
    Views:
    461
  2. Timo
    Replies:
    4
    Views:
    502
  3. Thomas Nick
    Replies:
    0
    Views:
    1,978
    Thomas Nick
    Jun 13, 2005
  4. Ryan Macy

    Ideas needed & help needed!

    Ryan Macy, Jul 19, 2006, in forum: Ruby
    Replies:
    2
    Views:
    545
    Ryan Macy
    Jul 19, 2006
  5. John Farold
    Replies:
    0
    Views:
    409
    John Farold
    Aug 29, 2012
Loading...

Share This Page