Difference between and
with text-align:center;?

前端 未结 6 1157
粉色の甜心
粉色の甜心 2020-12-01 02:24

I don\'t understand this:

I have tried to center the text-align of a HTML tag but it did nothing... With the

tag,
6条回答
  •  庸人自扰
    2020-12-01 02:50

    Spans are inline, divs are block elements. i.e. spans are only as wide as their respective content. You can align the span inside the surrounding container (if it's a block container), but you can't align the content.

    Span is primarily used for formatting purposes. If you want to arrange or position the contents, use div, p or some other block element.

提交回复
热议问题