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

M

marcwentink

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.
 
S

Steve Pugh

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
 
M

marcwentink

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.
 
A

Andy Dingley

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top