SharePoint Designer 2007 & 2010 removing closing tags

Problem:
You put an <h2> or other element tag around masterpage or page layout content in SharePoint Designer 2007 or 2010.

Everything is great. You can’t believe your geeky HTML skills are still getting things done. Check in the file, approve.. BLAM you look at the page and everything is messed up! What the.. go back to Designer, check your handiwork, and you see some glaring yellow highlighting indicating that suddenly, your H1 tag or whatnot no longer has a closing element – If you HAD put <h2>..content..</h2>, the CLOSING TAG is now evaporated through sheer lunacy. Or maybe it’s following XHTML standards. Who knows – all i know is when I put in a closing tag it damn well should stay there or at least warn me that I made a boo boo:

 

Solution:
Add an extra closing tag. So, in our example, we tried adding an <h2> </h2>tag around the ContentSection1Title tag. Designer promptly ate the closing </h2> tag. So, just add </h2></h2> at the end. Ignore SharePoint Designer highlighting the duplicate closing tag as erroneous: as soon as you press Ctrl-S and save the file it will remove one closing tag but leave the other:

There you go, hacking SharePoint Designer for stress-free WYSIWG.

designer, malformed HTML, missing closing tag

Comment

  • Hi,

    while this is an old post, it still exists in SharePoint Designer 2013.
    Your solition works the first time, but you have to repeat it for every save.

    The problem is the self closing webcontrols field. When you add an closing tag to the webcontrols field, the closing h2 tag stays in place.

Leave a Reply

Your email address will not be published. Required fields are marked *