Лучший вариант, с которым я столкнулся, - это , но этот антисемантический HTML и требует некоторых CSS для сброса любого стиля, включенного в браузер.
Есть ли лучшее решение?
Код: Выделить всё
.wrapper {
display: inline-block
}Код: Выделить всё
The content I want to wrap:
wrap this pwrap this spanwrap this b[/b]
[b]
wrap this h2
div (valid but changes layout):
wrap this pwrap this spanwrap this b[/b]
[b]
wrap this h2
a (not semantic, risks browser styling):
wrap this pwrap this spanwrap this b[/b]
[b]
wrap this h2
span (not technically valid):
wrap this pwrap this spanwrap this b[/b]
[b]
wrap this h2
div inline-block (makes everything inline and has formatting issues like the p gets closed early):
wrap this pwrap this spanwrap this b[/b]
wrap this h2Подробнее здесь: https://stackoverflow.com/questions/797 ... e-elements