Invalid span tag. Expected closing br tag

2019-08-30 05:24发布

问题:

I am trying to convert html to pdf using iText and getting below error.

Invalid span tag. Expected closing br tag

How is this an invalid xhtml ?

<span style="font-size: 10pt; line-height: 14.2667px;"><br/></span>

回答1:

A span is an inline element, and a smallest element of xhtml tree. styling tags like <u>, <i>, <strong> can be reside there.

A <br> or a <hr> is a full width element. Hence it is suggested to use <br> inside a <div></div>



标签: itext