HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials
  • Insights
  • Verify Certificate
HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials
HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials

HTML5andCSS3.org helps developers learn modern frontend skills with practical tutorials, production-ready snippets, and fast web tools built for everyday coding.

Quick Links

  • About Us
  • Contact Us
  • Privacy Policy
  • Copyright
  • Disclaimer

Top Tools

  • Try It Editor
  • JSON Formatter
  • CSS Minifier
  • HTML Minifier
  • Base64 Encoder / Decoder

Contact

  • business@html5andcss3.org
Newsletter

Learn at your own pace, practice with useful tools, and build websites you're proud of.

© 2011-2026 html5andcss3.org. All rights reserved.

How to Use

CSS Tutorial

CSS Introduction

What is CSSCSS SyntaxHow to Add CSSCSS Comments

CSS Foundations

Cascade & InheritanceCSS SpecificityCSS UnitsBox SizingCSS VariablesCSS Math Functions

CSS Selectors

CSS Element SelectorCSS Class SelectorCSS ID SelectorCSS Universal SelectorCSS Group SelectorCSS CombinatorsCSS Attribute SelectorsCSS Pseudo ClassesCSS Pseudo Elements

CSS Colors and Backgrounds

CSS ColorsCSS HEX ColorsCSS RGB ColorsModern ColorsCSS Background ColorCSS Background ImageLayered Backgrounds

CSS Text & Fonts

CSS Text ColorCSS Text AlignmentCSS Text DecorationCSS Font FamilyCSS Font SizeWeb Fonts & TypographyText Wrapping

CSS Box Model

CSS MarginCSS PaddingCSS BorderCSS OutlineCSS Width and Height

CSS Layout

Normal FlowCSS DisplayCSS PositionAnchor PositioningCSS FloatCSS OverflowCSS Z-indexIntrinsic SizingAspect Ratio & Object FitMulti-column Layout

CSS Flexbox

Flex ContainerFlex DirectionJustify ContentAlign ItemsFlex WrapFlex Item Sizing

CSS Grid

CSS Grid ContainerCSS Grid ColumnsCSS Grid RowsCSS Grid GapCSS Grid Layout ExampleGrid PlacementGrid AreasCSS Subgrid

CSS Lists, Tables & Forms

CSS ListsCSS TablesCSS Form StylingCSS Input Fields

CSS Effects

CSS ShadowsCSS GradientsCSS FiltersCSS OpacityClipping & MaskingBlending & BackdropScroll Snap

CSS Animations & Transitions

CSS TransformCSS 2D TransformCSS 3D TransformCSS TransitionsEntry & Exit TransitionsCSS AnimationsScroll AnimationsView TransitionsMotion Paths

CSS Responsive Design

CSS Media QueriesResponsive LayoutMobile First DesignContainer QueriesPreference Media QueriesFeature Queries

Modern CSS Authoring

Cascade LayersNesting & ScopeLogical PropertiesGenerated Content

CSS Accessibility

Accessible CSSCSS ThemingModern Form StylingCSS User Interface

CSS Output & Performance

Print StylesCSS PerformanceCSS ArchitectureDebugging CSS

CSS Reference

CSS At-rulesCSS FunctionsCSS Tutorial PDF

CSS Projects

Responsive CSS Project
  1. Home
  2. /
  3. Tutorials
  4. /
  5. CSS Tutorial
  6. /
  7. CSS Text Decoration

CSS Text & Fonts

CSS Text Decoration

The CSS Text Decoration property is used to add or remove decorative lines from text.

It is commonly used to:

  • Underline text
  • Add overlines
  • Strike through text
  • Remove underlines from links

Text decoration helps emphasize content and improve the visual appearance of web pages. The supporting concepts are explained in CSS Pseudo Classes and Accessible CSS.

Syntax

CSS Text Decoration Syntax

css

selector {
    text-decoration: value;
}

CSS Text Decoration Example

css

h1 {
    text-decoration: underline;
}

This adds an underline below all <h1> elements.

Attributes

ValueDescriptionExample
noneRemoves decorationtext-decoration: none;
underlineAdds a line below the texttext-decoration: underline;
overlineAdds a line above the texttext-decoration: overline;
line-throughAdds a line through the texttext-decoration: line-through;
underline overlineApplies multiple decorationstext-decoration: underline overline;

Decoration belongs to the text

Modern text decoration separates line, color, style, and thickness. Use text-underline-offset to keep an underline clear of glyphs and text-decoration-skip-ink when supported to improve legibility. Links should remain identifiable without relying only on color, and removing their underline requires another consistent visual cue in every interaction state.

Example

CSS Text Decoration Complete Example

html

<!DOCTYPE html>
<html>
<head>
    <title>CSS Text Decoration Example</title>
    <style>
        .underline {
            text-decoration: underline;
        }
        .overline {
            text-decoration: overline;
        }
        .line-through {
            text-decoration: line-through;
        }
        .no-decoration {
            text-decoration: none;
        }
    </style>
</head>
<body>
    <h1 class="underline">Underlined Heading</h1>
    <p class="overline">This paragraph has an overline.</p>
    <p class="line-through">This text has a line through it.</p>
    <a href="#" class="no-decoration">Link Without Underline</a>
</body>
</html>

Browser Support

Feature
Chrome
Edge
Firefox
Safari
text-decoration11211

Versions show the first stable desktop release with unprefixed support. Data source: MDN Browser Compatibility Data 8.0.8.

Notes

  • Links () are underlined by default in most browsers.
  • text-decoration: none; is commonly used to remove link underlines.
  • Multiple decorations can be combined.
  • Modern CSS also supports text-decoration-color, text-decoration-style, and text-decoration-thickness.
  • Text decoration affects only the appearance of text, not its functionality.

Conclusion

The CSS Text Decoration property allows you to add visual emphasis to text through underlines, overlines, and strike-through effects. It is especially useful for styling links and highlighting important content while maintaining a clean and professional design.

PreviousCSS Text AlignmentNextCSS Font Family