1

I have the following .html

<p>
    <input class="inputName" />
    <ul>
         <li>One value</li>
    </ul>
</p>

In google chrome, firefox and safari i got (in the source explorer)

<p>
    <input class="inputName" />
</p>
<ul>
     <li>One value</li>
</ul>

I can't reproduce the issue, it come from my smarty template .... somewhere but i have no idea where.

I don't know where to look. Every tags are closed. Have you ever seen that problem ?

Sancho
  • 1,288
  • 2
  • 25
  • 50

2 Answers2

2

This is because the <p> tag cannot contain other block elements. You most-likely want to use <div> instead of <p>:

<div>
    <input class="inputName" />
    <ul>
         <li>One value</li>
    </ul>
</div>
Robert Messerle
  • 3,022
  • 14
  • 18
2

Chrome and Firefox are modifying the DOM in an attempt to comply with HTML standards, as ul/ol elements can't reside within a p node.

p cannot contain block-level elements (div, ul, ol), only inline elements (span).

Community
  • 1
  • 1
esqew
  • 42,425
  • 27
  • 92
  • 132