CSS multiple text-decoration
Asked Answered
A

2

14

I want to have the <h2> underlined and blinking at the same time.
Is there any way to achieve this modifying only the CSS style of <h2>?

For instance:

h2 {
  text-decoration: underline, blink;
}

or

h2 {
  text-decoration: underline;
  text-decoration: blink;
}

none of the above works

If there is no such way what is the fastest/easiest way to do it?

Alga answered 27/3, 2012 at 2:7 Comment(4)
Have you tried text-decoration: underline blink?Whitaker
according to sitepoint, Conforming user agents are allowed to ignore this value, since blinking content can be detrimental to a page’s accessibility. - and most browsers are "buggy" in supportCapstan
The only reason to add blink is when you're designing a site that makes fun of old techniques.Berne
Thank you Joseph, but it's not targeting a productivity site, it's just for personal use. And either way someone might want to have both underline and line-through.Alga
W
27

You need to space separate them:

text-decoration: underline overline line-through;

http://jsfiddle.net/PamjT/

Whitaker answered 27/3, 2012 at 2:11 Comment(2)
This is the syntactically-correct way, but I assume that you linked to a fiddle with a different set of decorations for a good reason, and I applaud you for it :)Heterogeneous
@Frederick Marcoux: FLAGGED >:(Heterogeneous
S
1

Easiest is to set border-bottom to your h2:

h2 { 
   border-bottom:1px solid black;
   text-decoration:blink;
}

Please note that blink isn't supported in IE, Chrome and Safari

Shied answered 27/3, 2012 at 2:8 Comment(2)
A bottom border will stretch across the width of a block element which may or may not be what the OP wants, because it's not a text decoration (obviously).Heterogeneous
I'm aware of that, didn't know you could specify two values in a text-decoration declaration :(, o well thanks @Heterogeneous :)Shied

© 2022 - 2024 — McMap. All rights reserved.