Using CSS To Change The Colour Of The Strike-Through Line but Not The Text
Posted: 06 January 2008 03:53 AM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  222
Joined  02-18-2007

So much for short titles…

Anyway…the thing I’d like to accomplish is this…

<span style="text-decoration:line-through;">Stricken Text</span>

But with the text one colour and the line through another. You can sort of do this with underlines and overlines. Is it possible with strike-through’s though?

Thanks in advance!

 Signature 

KMRL Mojo Radio Live!
My Blog | Current Version/Build

“The battle for life is a battle for sanity.” - Rabbi Noach Weinberg, zt"l

Must-Have Addons:

Accessible CAPTCHA [2.0 READY]
Akismet for EE

Profile
 
 
Posted: 06 January 2008 04:57 AM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  918
Joined  02-05-2002

Hi Bobby,

This is one way to do it:

CSS:

<style type="text/css">
del {
    color
: red;
}
del span {
    color
: black;
}
</style>

HTML:

<del><span>Stricken Text</span></del>

Another way is using a background image to fake it.

 Signature 

Member of the EE Pro Network

Profile
 
 
Posted: 06 January 2008 05:00 AM   [ Ignore ]   [ # 2 ]  
Grad Student
Avatar
Rank
Total Posts:  43
Joined  09-09-2007

I’m not too shure, but I don’t think you can change the color of the line throught. I tried using the < del > html tag, but no results raspberry

 Signature 

http://bdesign.i-blog.ro

Profile
 
 
Posted: 06 January 2008 06:42 AM   [ Ignore ]   [ # 3 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10822
Joined  04-15-2006

Hiya,

Just to say that I’m pretty sure that what Cocoaholic has provided should work just fine. Maybe test it in a few browsers to see if it works for you?

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 05 March 2009 08:17 PM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  1
Joined  03-05-2009

It works just fine with the “s” tag for strikethrough. Thanks!

html

<s><span>Stricken Text</span></s>


css

<style type=“text/css”>
  s {
      color: red;
  }
  s span {
  color: black;
  }
</style>

Profile
 
 
Posted: 05 March 2009 09:31 PM   [ Ignore ]   [ # 5 ]  
Lab Technician
RankRankRankRank
Total Posts:  1367
Joined  05-15-2004

If <del> and <s> don’t work, try <strike>.

 Signature 

Oh, holy .

Profile
 
 
Posted: 09 March 2009 11:18 AM   [ Ignore ]   [ # 6 ]  
Grad Student
Avatar
Rank
Total Posts:  64
Joined  06-23-2008

Just for reference, <strike> and <s> are not valid XHTML Strict elements.

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1743, on December 02, 2009 03:47 PM
Total Registered Members: 120285 Total Logged-in Users: 38
Total Topics: 126407 Total Anonymous Users: 18
Total Replies: 664771 Total Guests: 322
Total Posts: 791178    
Members ( View Memberlist )