SHARE
Facebook X Pinterest WhatsApp

A Peek Inside the CSS Text Decoration Specification

Written By
thumbnail
Vipul Patel
Vipul Patel
Aug 26, 2014

Text decoration is defined as decorating the glyphs of the text once typeset according to font and typographic rules.

CSS3 provides support for text decoration. This support comes in the form of underlines, text shadows and emphasis marks.

Earlier versions of the CSS specification for text decoration provides only very basic line decorations which were appropriate to Western typographical traditions.

When the line decorations are specified on a inline box, that box becomes a decorating box which would apply the decoration to all its fragments.

 

Let us now look at the various CSS3 properties to support text decoration.

 

text-decoration-line

This property specifies what line decorations are needed to an element. Valid values are:

none – Does not produce or stop text decoration

underline – all text is underlined

overline – the text has a line over it.

line-through – Each line of text has a line through the middle

blink – the text will blink.

 

text-decoration-color

This property specifies color of text decoration set on an element. Acceptable value is any valid  ‘color’ value.

 

text-decoration-style

This property specifies the style of the line which is drawn. Valid values are: solid, double, dotted, dashed and wavy.

 

text-decoration

This is a shorthand to setting text-decoration-line, text-decoration-color and text-decoration-style.

 

text-decoration-skip

This property specifies the part of the element that the text decoration effect will not apply to. Valid values are:

  • none – This means no part of the element is skipped.
  • objects –  This value will cause it to skip the element if it is an image or inline-block
  • spaces – This value will cause it to skip all spacing
  • ink – This value will cause it to skip over glyphs.

Other values are “edges”  and “box-decoration”.

 

text-underline-position

This property specifies the position of the underline on the element. Valid values are “auto”, “under”, “left”, and “right”.

 

text-emphasis-style

This property specifies the emphasis marks on the element’s text. Valid values are ‘none’, ‘filled’, ‘open’, ‘dot’, ‘circle’, ‘double-circle’, ‘triangle’, and ‘sesame’.

 

text-emphasis-color

This property specifies the color of the emphasis marks on the element’s text. All valid colors are acceptable values.

 

text-emphasis-position

This property specifies the position of the emphasis marks on the element’s text. The valid values are ‘over’, ‘under’, ‘right’, and ‘left’.

 

text-shadow

The property is used to specify shadow effect to be applied to the text of the element.

 

Example of text decoration

<!DOCTYPE html>

<html><head>

<meta charset=”utf-8″>

<style>

span{

     text-emphasis-style: filled dot;

}

</style>

</head>

<body>

<p>We expect a dot above every single character of ” sample”.</p>

<div><span>sample</span></div>

</body></html>

 

Summary

In this article, we learned about CSS3 text decoration module. I hope you found this information useful.

 

About the author

Vipul Patel is a technology geek based in Seattle. He can be reached at vipul.patel@hotmail.com. You can visit his LinkedIn profile at https://www.linkedin.com/pub/vipul-patel/6/675/508

 

References

http://www.w3.org/TR/css-text-decor-3/

 

Recommended for you...

Best VR Game Development Platforms
Enrique Corrales
Jul 21, 2022
Best Online Courses to Learn HTML
Ronnie Payne
Jul 7, 2022
Working with HTML Images
Octavia Anghel
Jun 30, 2022
Web 3.0 and the Future Of Web Development
Rob Gravelle
Jun 23, 2022
HTML Goodies Logo

The original home of HTML tutorials. HTMLGoodies is a website dedicated to publishing tutorials that cover every aspect of being a web developer. We cover programming and web development tutorials on languages and technologies such as HTML, JavaScript, and CSS. In addition, our articles cover web frameworks like Angular and React.JS, as well as popular Content Management Systems (CMS) that include WordPress, Drupal, and Joomla. Website development platforms like Shopify, Squarespace, and Wix are also featured. Topics related to solid web design and Internet Marketing also find a home on HTMLGoodies, as we discuss UX/UI Design, Search Engine Optimization (SEO), and web dev best practices.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.