The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 11 of 11

Thread: How to change color of the underline but not the text?

  1. #1

    How to change color of the underline but not the text?

    hi,

    Say for example i have a white text, I want to change the color of the underline to red, leaving the text white as it was.

    How can i do it? I tried every possible way...

    Any help is appreciated...

  2. #2
    4,029
    posts
    home cooking is killing the restaurant industry
    maybe use a border instead of an underline?
    There are only 10 kinds of people in this world:
    Those that might know ternary, those that do, and those that don't
    Say NO to DRM.

  3. #3
    here you go

    <html>
    <head>
    <style>
    u.style
    {color:#FF0000;}
    span.style2
    {color:#000000;}
    </style>
    </head>
    <body>
    <u class="style"><span class="style2">some text</span></u>
    </body>
    </html>
    'Disk 1 of 1.' That means there's another one around here somewhere.

  4. #4
    of course if you're trying to make a standards compliant page, or are just meticulous real_illusions idea won't be what you want to do.

    _Michael

  5. #5
    Quote Originally Posted by MichaelxxOA
    of course if you're trying to make a standards compliant page

    in what way??

    i know i've missed out doctype and all the other stuff...

    or do you mean something else?
    'Disk 1 of 1.' That means there's another one around here somewhere.

  6. #6
    I think he means that it doesn't validate as xhtml strict As "u" is not valid for xhtml 1.0 strict.So the code would need to be like this:
    CSS
    Code:
    .underline {
     color:#FF0000;
     text-decoration: underline;
    }
    .text {
     color:#000000;
    }
    and html
    PHP Code:
    <div class="underline"><span class="text">some text</span></div

  7. #7
    and where do i keep this code? I'm kind of a beginner at front page 2003

  8. #8
    Hisham, open a new notepad file, copy and paste the following text:
    Code:
    <html>
    <head>
    <style>
    .text { border-bottom: solid red; }
    </style>
    </head>
    <body bgcolor="black">
    <font color="white"><span class="text">This text is white and underlined in red</span><font>
    </body>
    </html>
    Save the file as Text.html and then open the Text.html file.
    If you want to try this in Frontpage, open a new frontpage file, go to the source code view and then, replace whatever u see there with the code above. You will get what you want.

    Some tips: to suit the width of the underline with your web, you can set the size. All you have to do is, change within the style tag as follows:

    Code:
    <style>
    .text { border-bottom: solid red 2px; }
    </style>
    where the 2px represents the size of the border. I hope this is sufficient enough for you.

  9. #9
    Sorry, but I don't see the point of using both inner and inline css.

    So, your html page would be like:

    PHP 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>page title</title>
    <
    style type="text/css">
    .
    underline {
    color:#ff0000;
    text-decorationunderline;
    }
    .
    text {
    color:#000000;
    }
    </
    style>
    </
    head>
    <
    body>
    <
    div class="underline"><span class="text">some text</span></div
    </
    body>
    </
    html

  10. #10
    176
    posts
    Registered User
    I'm w/ ditto ... but how bout a litte less typing ...

    HTML Code:
    <style type="text/css">
    .underline {
    color:#ff0000;
    text-decoration: underline;
    }
    .underline span{
    color:#000000;
    }
    </style>
    </head>
    <body>
    <div class="underline"><span>some text</span></div>
    </body>
    PHP Code:
    <zip> echo this; </zip

  11. #11
    Well, he's still new in HTML thingy so I just tried to introduce more stuff to him. That was why I was at his place once and we all were Gotta understand the complexity bro~

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012