What had happened?
A client of mine was writing content on his website and he had a question. So I went to see and I noticed something odd in his html. He had a piece of text that he wanted to be strong and emphasized.
So he did <strong> <em> (actually he just wanted it bold and italic, but I never told him about the <b> and <i>). That is actually fine but then he closed them with </strong> and </em>. Anyone with a little knowledge about HTML knows that tags must be nested, so you cannot open a strong tag then open an em tag and close the strong first.
Why did he do that for
So I went to ask this client: "Why did you do it in this way?". And I must say, his answer baffled me by logic. He just said I opened those tags, and I did not want to mis-spel any closing tags, so I copied / pasted them again and added a slash.
There I was, I could not agree more with this logic.
The solution was easy, I told him that he should not do that anymore, and how he should use the tags
But just in case he does it again, I installed the HTML purifier module for him. So if he does it again the module will swap the closing tag automatically.
- Perfectly valid html, even when is is not written valid
- Search engines will be happy
- But most of all, screen-readers might not understand invalid html, so it is fixed