Link to something on same page?

Discussion in 'CSS' started by kathyk, Nov 28, 2008.

  1. #1
    In html, we can use <a href="#Link's_Title"> and <a name="Item_to_jump_to_on_the_same_page"> to link to another item on the same page. Can we not use this method in html pages when using css, or is there another method? My item to jump to is showing up as a link (even though it's not linked to anything), but it doesn't do this in a regular html page with no css involved. Sorry--I'm a genuine beginner.
     
    kathyk, Nov 28, 2008 IP
  2. irunbackwards

    irunbackwards Peon

    Messages:
    791
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It functions the same whether or not you are using CSS. Because you've given it a style in CSS (a:link, a:visited, a:active, a:hover) .. it will take those CSS properties. Give it its own class and style it separately than a normal link and you're good to go.
     
    irunbackwards, Nov 28, 2008 IP
  3. kathyk

    kathyk Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you so much for the reply. I've been all over some CSS tutorials and I'm still not sure how to give something it's own class and style it separately. I'm completely new to this; I just know some html. If I'm asking for more than I should on this forum, please let me know; I'm just wondering if you could give me a bit more help with this. Thanks so much.

    Kathy
     
    kathyk, Nov 29, 2008 IP
  4. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #4
    a:link is a subset of a. It, a:link, applies when there is an href attribute.

    By default, in most browsers, the colors are a, a:link, a:visited, a:hover, and a:active.

    To make a target anchor the same color as your text, set a {color: inherit;}. IE does not support inherit, so you'll need to be specific, e.g. a {color: black;}. This adds to the maintenance cost, but that's IE for you.

    Having set a, you will need to reset the pseudo classes:

    a:link {color: blue;}
    a:visited {color: magenta;}
    a:hover {color: blue;}
    a:active { color: red;}

    Be sure your selectors are in that order, to maintain precedence.

    cheers,

    gary
     
    kk5st, Nov 29, 2008 IP
  5. kathyk

    kathyk Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks, and sorry to be so dumb, but where, exactly, do I put {color: black;}? In style.css or the html file? "a" is set up like the following. Can I just leave it like this?

    a {

    color: #BE8571;

    font-weight: bold;

    text-decoration: none;

    }

    a:hover {

    color: #000000;

    text-decoration: underline;

    }
     
    kathyk, Nov 29, 2008 IP
  6. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #6
    Is that the color, font-weight and text-decoration you want for the target anchors? If not, what do you want? Or, is that the color, etc. you want for links?

    cheers,

    gary
     
    kk5st, Nov 29, 2008 IP
  7. kathyk

    kathyk Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    That is the color, etc., that I want for the links. For the target anchors, I want them to not act as a link, and I want them in black.
     
    kathyk, Nov 29, 2008 IP
  8. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #8
    Then use this in place of what you have in the css file.
    
    a {
        color: black;
        text-decoration: none;
        }
    
    a:link {
      color: #BE8571;
      font-weight: bold;
      }
    
    a:visited {
      color: [some other color];
      }
    
    a:hover {
      color: black;
      text-decoration: underline;
      }
    Code (markup):
    Go to htmldog.com, and work through their tutorials. You will expand your knowledge enough to feel more confidence in what you're doing.

    cheers,

    gary
     
    kk5st, Nov 29, 2008 IP