naming closing tags: <tr id="taggingtest">&nbsp</tr id="taggingtest">

Discussion in 'HTML' started by marcwentink@hotmail.com, Feb 7, 2006.

  1. Guest

    I wonder if the following is a legal thing to do:

    <tr id="taggingtest">&nbsp</tr id="taggingtest">

    The reason for doing this is that I somehow want to comment which
    closing tag should in theory refer to which opening tag, usefull if you
    have a large table, and several tables within a table. So it is a sort
    of comment I want to add, but then comment inside the closing tag.
     
    , Feb 7, 2006
    #1
    1. Advertising

  2. Steve Pugh Guest

    wrote:
    > I wonder if the following is a legal thing to do:
    >
    > <tr id="taggingtest">&nbsp</tr id="taggingtest">


    No.

    > The reason for doing this is that I somehow want to comment which
    > closing tag should in theory refer to which opening tag,


    There should never be any doubt. The rules of HTML work in such a way
    that a closing tag can only be associated with one opening tag. If
    there's any doubt then that must be due to invalid code. (In XHTML
    where all closing tags are required it's even more straightforward to
    work out which closing tag belongs to which opening tag.)

    > usefull if you
    > have a large table, and several tables within a table.


    There are very few cases where a table of data would contain another
    table of data as part of its data. Are you abusing tables for layout
    purposes?

    > So it is a sort of comment I want to add, but then comment inside the
    > closing tag.


    Use a comment adjacent to the closing tag. Or adopt a system of
    indenting that allows you to line up closing and opening tags and see
    at a glance which one ends where. Many decent HTML editors will allow
    you to select a whole element by clicking on its opening or closing
    tag. So lots of ways to do what you want without making your code
    invalid.

    If you do want to put attributes in closing tags within your working
    environment, make sure that you strip them out as part of your
    deployment to your live environment.

    Steve
     
    Steve Pugh, Feb 7, 2006
    #2
    1. Advertising

  3. Guest

    Steve:

    >Are you abusing tables for layout purposes?


    Yes I am. Much of the HTML sources I see in this job are doing this.
    That's bad practise then I presume? Well bad example, and a bad copy I
    am afraid.
     
    , Feb 7, 2006
    #3
  4. Andy Dingley Guest

    wrote:
    > I wonder if the following is a legal thing to do:
    >
    > <tr id="taggingtest">&nbsp</tr id="taggingtest">


    No. Get yourself an editor that can auto-close tags for you.
     
    Andy Dingley, Feb 7, 2006
    #4
    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. Nathan Sokalski
    Replies:
    2
    Views:
    467
    Scott M.
    Sep 17, 2005
  2. Harman
    Replies:
    1
    Views:
    2,525
    Moiristo
    Jul 28, 2006
  3. =?Utf-8?B?Vk1J?=

    Closing popup window when closing parent window?

    =?Utf-8?B?Vk1J?=, Feb 14, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    661
    Thomas Hansen
    Feb 15, 2007
  4. thomas
    Replies:
    0
    Views:
    235
    thomas
    Oct 23, 2003
  5. hotkitty

    Parsing CSV and "&nbsp;&nbsp;"

    hotkitty, Oct 9, 2008, in forum: Perl Misc
    Replies:
    9
    Views:
    352
Loading...

Share This Page