Click to See Complete Forum and Search --> : Some way to identify Closing Tags?


august
08-14-2006, 02:17 PM
What's a convenient way to identify which closing html tag belongs to which opening html tag?

Say if you have a lot of p tags with id's and class attributes, and want to know where the p with an id of "p1" closes, if you've forgotten?

felgall
08-14-2006, 02:31 PM
Since you can't nest paragraphs within paragraphs, the next </p> following the <p id="p1"> will be the closing tag that matches that opening tag. Figuring out which close tag matches which open tag only becomes a problem with those tags you can nest inside one another such as <div><div><div></div></div></div>.

Charles
08-14-2006, 02:43 PM
The traditioanl way to keep it straight is to use indentation.

august
08-14-2006, 02:52 PM
felgall, p tags, it was just for example. But let's say you have div tags, what then?

Is there a way to know once you've messed up?

Charles
08-14-2006, 03:04 PM
http://tidy.sourceforge.net/

http://validator.w3.org/

KenJackson
08-14-2006, 03:10 PM
Use emacs, html mode.
Position the cursor on an opening tag, press C-c right-arrow, and the cursor jumps to the matching closing tag.

august
08-14-2006, 03:45 PM
Thanks, shoulda used the w3c's validator (told you it was confusion:)