Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Text Link Color

  1. #1
    Join Date
    Apr 2006
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Text Link Color

    I am searching for a code that would make a sentence or a word have one link color seperate from another word or sentence with antoher link color. Other words, I don't want to have all of my links visible in one color.

    Thanks in advance,
    NADB

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Just change the color of text? (Yes, within a link.)

    Well... depending on your use of css (style sheet... formatting) or just a body tag with default colors OR even nothing and using the default blue, you will have some predefined color for links... probably blue.
    (Note: the blue is good because beginning web users might not understand another color to be a link if it's not clear.)

    so... what you need to do is override that.

    the a tags (<a href=....>clickme</a>) set the color automatically to the color that is the default, as above, probably blue.
    All you need to do is set the color like any other text, but INSIDE that.


    <a href="link.htm"><font color="#FF0000">red link</font></a>

    Note that putting the font tag outside the link will not set the color. (<font color=...><a href=...>text is the default color still</a></font>)


    That should do it!


    Or, if you want the whole page:
    <body text="#00FF00"> would give you green.

    Or, you could use css:
    In the head section of your page:
    <html>
    <head>
    <style type="text/css">
    a {color:#00FF00}
    </style>

    </head>
    <body>
    ....
    </body>
    </html>
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    <a href="link.htm"><font color="#FF0000">red link</font></a>
    Urgh, yuck.
    Never use <font> elements.

    Code:
    <style type="text/css">
    .linkone a {
      color: red;
    }
    
    .linktwo a {
      color: lime;
    }
    
    .linkthree a {
      color: blue;
    }
    </style>
    
    <p><span class="linkone">This bit has <a href="google.com">red links</span>; <span class="linktwo">this has <a href="fsf.org">lime</a>;</span> and</p>
    <p class="linkthree">... this whole paragraph will have <a href="dynamicdrive.com">blue</a> links.</p>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Never use <font> elements.
    This guy just wants to change font color a single link.
    Surely css isn't needed. It's more to learn and more to mess with.
    <font> is plenty valid and works just fine.

    css is better if you're using the same setup more than once though.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    <font> is plenty valid and works just fine.
    It may "work fine," but, like table layouts, it should never have been invented. It causes the unwary developer to mix content and presentation, causing code that lacks semantics and is difficult to read and maintain.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I'm still picking out font tags from a site I inherited about three years ago. They're just about all gone now, and it is so much easier to maintain. Now, if I could just get everything to validate.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    like table layouts
    ...tables are bad too?!
    So useful.

    I get that CSS is nice. But only if you need to automate all of it. for a single link/line of text, it's so easy to use that.


    I agree, though, for larger automated sites, css, and external css at that, is a must. But not for one tag.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    But not for one tag.
    You're telling me seriously that you've ever designed a site that uses just one fomatting tag?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #9
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Sure. One occurance of a particular color, size, etc. for a font.

    ONE time on the page there should be red text. Or big text. Whatever.

    css can still be used, but doesn't help/save time for that particular element... actually wastes space.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Sure. One occurance of a particular color, size, etc. for a font.
    Oh, you mean something totally out-of-sync with the rest of the site's theme?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •