ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Using CSS To Change The Colour Of The Strike-Through Line but Not The Text

January 06, 2008 4:53am

Subscribe [5]
  • #1 / Jan 06, 2008 4:53am

    Bobby McGee

    132 posts

    So much for short titles…

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

    <span>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!

  • #2 / Jan 06, 2008 5:57am

    Cocoaholic

    445 posts

    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.

  • #3 / Jan 06, 2008 6:00am

    Bdesign

    23 posts

    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 😛

  • #4 / Jan 06, 2008 7:42am

    Mark Bowen

    12637 posts

    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

  • #5 / Mar 05, 2009 9:17pm

    webmystery

    1 posts

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

    html

    <s>Stricken Text</s>


    css

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

  • #6 / Mar 05, 2009 10:31pm

    ak4mc

    429 posts

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

  • #7 / Mar 09, 2009 1:18pm

    jacksonhyde

    61 posts

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

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases