According MDN span
's permitted content is Phrasing content
and div
is Flow content
.
I was looking at the html generated source of Facebook and I noticed they wrapped the "find friends" main search input in a span
and marked it display:block
. To me this seems ridiculous since a div
is a block level element and a span
is inline.
And according to MDN:
<span>
is very much like a<div>
element, but<div>
is a block-level element whereas a<span>
is an inline element.
Why didn't they just use a div? Is a span
a better choice because it is for phrasing content? Or maybe it was just not a big deal to them?
Is there any reason that one should wrap a search input
in a span
vs a div
?