what is the span tag used for in a html document code example

Example 1: span html

The HTML <span> element is a generic inline container for
pieces of content, which does not inherently represent anything. 
It is mostly used for grouping and styling bits of content.
<span> is very much like a <div> element, but <div> is a 
block-level element whereas a <span> is an inline element.

Example 2: javascript span style

//an example of an "out of context" way to change color of a text:
<span style="color: green"></span>