What is a <span> tag?
Experience Level: Junior
Tags: HTML
Answer
- The
<span>
tag is used as a container to group parts of text - The
<span>
is similar to<div>
tag, but it is in-line element, which means it doesn't start on the new line when rendered in the browser - The
<span>
doesn't change a look of a text in any way, unless a CSS style is applied to it - The attributes that are often used in the
<span>
tag areclass="..."
andstyle="..."
. We don't recommend using the latter as the in-line styles are generally considered a bad practice.
Related HTML job interview questions
What is a <label> tag?
HTML JuniorWhat is a <p> tag?
HTML JuniorWhat is a <div> tag?
HTML JuniorWhat is a basic structure of the HTML page?
HTML JuniorWhat is the difference between html Element and Attribute?
HTML Junior