XHTML Strict: br tag inside p tag
Asked Answered
P

1

12

I get lots of validation errors because of <br /> inside <p>. If I remove the br tags then it works fine.

Why is it creating a problem?

Pennell answered 22/4, 2010 at 10:1 Comment(1)
I can't get link to work. <br /> should work fine. Are you sure that your <br> is terminated like this <br /> ?Cornute
D
21

It's not that the br is inside the p, but rather you're not ending the br with the / character. You have <br> in the code, when it should be <br/>. Which is why the validation error is "end tag for "br" omitted", it's telling you that you've not ended the tag correctly with a /.

Note that in HTML4 it's not required to close the br tag with a final slash, but in XHTML it is required as it's a singleton tag.

Decorous answered 22/4, 2010 at 10:7 Comment(2)
Sorry, didn't see the answer you gave a few seconds earlier than me.Meingoldas
any idea if IE6 will get confused by <br/> or any other browsers?Swithbart

© 2022 - 2024 — McMap. All rights reserved.