SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot sularome's Avatar
    Join Date
    Jan 2006
    Location
    Poland
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Differen color for line-through

    Hi,

    i want to apply text-decoration:line-through; to a text but the line should be red and the text black. Do you have any idea how this can happen?

    Regards
    Yordan

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    39,823
    Mentioned
    158 Post(s)
    Tagged
    4 Thread(s)
    Hi,

    Yes you can do it like this:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    <style type="text/css">
    .test2 em,.test1 span {color:#000;font-style:normal;}
    .test2 span,p.test1{text-decoration:line-through;color:red}
    </style>
    </head>
    <body>
    <p class="test1"><span>This is some text that is crossed out with a red line</span></p>
    <p class="test2">This is some text that is<span> <em>crossed out with a red line</em></span> and this isn't crossed out.</p>
    <p>testing</p>
    </body>
    </html>

  3. #3
    SitePoint Zealot sularome's Avatar
    Join Date
    Jan 2006
    Location
    Poland
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Paul you must be some kind of genius :-)
    Is there something you don't know?

    Thanks a lot!

  4. #4
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    39,823
    Mentioned
    158 Post(s)
    Tagged
    4 Thread(s)
    Paul you must be some kind of genius :-)
    lol - far from it - I just keep trying things until I make it work


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •