Using CSS To Change The Colour Of The Strike-Through Line but Not The Text
Posted: 06 January 2008 02:53 AM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  216
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
Running 1.6.1 Build 20071114

“I know more than you do, for you think you know something, and I know I know nothing.” - Socrates


Must-Have Addons:

Accessible Captcha
Akismet for EE

Profile
 
 
Posted: 06 January 2008 03:57 AM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  891
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 04: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 05:42 AM   [ Ignore ]   [ # 3 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9246
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 07: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 08:31 PM   [ Ignore ]   [ # 5 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1292
Joined  05-15-2004

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

 Signature 

Scribe of Slog
The truth begs nobody’s pardon.

Profile
 
 
Posted: 09 March 2009 10: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 1149, on July 16, 2007 09:33 AM
Total Registered Members: 77485 Total Logged-in Users: 44
Total Topics: 101519 Total Anonymous Users: 26
Total Replies: 544261 Total Guests: 239
Total Posts: 645780    
Members ( View Memberlist )