html - Prevent span elements from wrapping -
my ui shows list of email addresses retrieved backbone. rendered span
of span
s contain span
s. here's typical generated html:
but getting breaks inside span
s (notice beginning of angelstwo on 2 lines), because using wrong html tags (ul
, li
sounds better list). can this:
i tried div
s got 1 entry per line , don't want that.
is there can make work span
s? or should change else ul
, li
?
span
elements are, default, inline elements. in inline formatting context boxes can wrap. (this happens text when wraps around floated image.)
div
elements are, default, block elements. in block formatting context boxes occupy available horizontal space (width: 100%
).
this why spans , divs aren't working want.
if switch display: inline
display: inline-block
, you'll block-level behavior, prevent wrapping line boxes, elements stack horizontally other inline elements.
w3c references: