Span Tag

A span tag, written as tag, is a generic inline container for inline content and elements. It s used for grouping and applying styles in the absence of another semantic element. There is no meaning in this tag as it is mostly used for styling purposes through a class or ID. The span tag is often compared to the

tag, but the latter is a block-level tag while the former is an inline tag.

The span tag can be used to change the font of separate phrases or words, highlight a part of a text using colors, define a background color or background image, and apply scripts to specific parts of a text. It is supported by various browsers, including Google Chrome, Internet Explorer, Mozilla Firefox, Safari, and Opera. The span tag supports both global and event attributes in HTML.

How to style tag

Use the following text layout styles:

  • Cascading Style Sheets (CSS) text-overflow property indicates how a user is signaled on overflowed content that is not displayed
  • CSS text-indent property specifies how to indent the first line in a text box
  • CSS word-break property identifies the points where the lines are broken
  • CSS white-space property specifies how to handle white space within an element

How to color text in tag:

  • CSS color property indicates the color of the text content and other text decorations
  • CSS background-color property specifies an element s background color

Properties that alter the size, emphasis, and visual weight of a text in tag:

  • CSS font-style property identifies the style of the font whether it is normal, italic, initial, oblique, or bold
  • CSS font-family property sets a prioritized list of font family names for a selected element
  • CSS font-weight property specifies if a font is bold or thick
  • CSS text-transform property sets the case and capitalization of the text in an element
  • CSS font-size property sets the font size
  • CSS text-decoration property identifies the decoration added to a text

Webopedia Staff
Webopedia Staff
Since 1995, more than 100 tech experts and researchers have kept Webopedia’s definitions, articles, and study guides up to date. For more information on current editorial staff, please visit our About page.
Get the Free Newsletter
Subscribe to Daily Tech Insider for top news, trends & analysis
This email address is invalid.
Get the Free Newsletter
Subscribe to Daily Tech Insider for top news, trends & analysis
This email address is invalid.

Related Articles

Complete List of Cybersecurity Acronyms

Cybersecurity news and best practices are full of acronyms and abbreviations. Without understanding what each one means, it's difficult to comprehend the significance of...

Human Resources Management System

A Human Resources Management System (HRMS) is a software application that supports many functions of a company's Human Resources department, including benefits administration, payroll,...

How To Defend Yourself Against Identity Theft

Almost every worldwide government agency responsible for identity theft issues will tell you the same thing: The first step to fighting identity theft is...

Infographic

An infographic is a visual representation of information or data. It combines the words information and graphic and includes a collection of imagery, charts,...

ScalaHosting

ScalaHosting is a leading managed hosting provider that offers secure, scalable, and affordable...

HRIS

Human resources information system (HRIS) solutions help businesses manage multiple facets of their...

Best Managed Service Providers...

In today's business world, managed services are more critical than ever. They can...