The primary difference between a div and a span is their default behavior. By default, a
is a block-level element and a is an inline element. In other words, if you want to adjust a small portion of text and not break it out of the current line, use a . If you need to modify a large division, the height, move an element, or contain other elements, use a
.Example of an HTML
Example of an HTML tag
Example text that is red text and an example of a span tag.
HTML code
Example text that is red text and an example of a span tag.
Example of an HTMLtagExample of a div tag with a maximum width of 200 pixels and a silver background.
Example of a div tag with a maximum width of 200 pixels and a silver background.
Related information
Example of a div tag with a maximum width of 200 pixels and a silver background.
Example of a div tag with a maximum width of 200 pixels and a silver background.