How to do a strikethrough with CSS

Posted in HTML and CSS -

This very short post covers something most people who work with CSS should already know how to do: how to do a strikethrough with CSS. I needed to do this today but didn't know which property sets it so had to look it up. I usually find by writing a short post like this I remember it in the future and never need to look it up again :)

The property and value to make text with a strikethrough is:

text-decoration: line-through

And an example:

this text is struck through

An example of making a CSS class have strikethrough text (and you can probably guess from the class name what sort of text I was putting a line through):

.fullprice {
    text-decoration: line-through;

Related posts: