A div is a block element and will span the width of the container unless a width is set. A span is an inline element and will have the width of the text inside it. Currently, in this first code we are trying to set align as a css property. Align is an attribute.
<span align="center" style="border:1px solid red;"> This is some text in a div element!
</span>
However, the Align attribute is deprecated, you should use the CSS text-align property on the container.
<div style="text-align: center;">
<span stlye="border:1px solid red;"> This is some text in a div element!
</span>
</div>
SOURCE | LINK (Stackoverflow.com) | LANGUAGE | ENGLISH |