Forums

"A Name" - no underlining please! (5 posts)

  1. jayess
    Member
    Posted 6 years ago #

    Hi all,

    I have set for all text to be underlined in my "a:link " within the css file.

    I noticed that it means that anything linked via "a name" will be underlined as well. See:
    http://www.jennifersando.com/livien/index.php/archives/44

    Is there anyway I can specify for the "a name" references to not be underlined without impacting the underline style for all the normal "a" links?

    I hope this makes sense.

  2. jonimueller
    Member
    Posted 6 years ago #

    The only anchor tags that can be styled (that I'm aware of) are a, a:link, a:active, a:visited and a:hover.

    Normally, when people use this tag it's to jump from one area of the page to another, and the opening and closing tags are usually back to back with no space in between that would be affected by underlining, e.g.

    <a name="gotothisparagraph"></a><h2>Featured Paragraph</h2>

    and so forth. How are you using this anchor tag?

    Anyway, to answer your question notwithstanding the above, you can designate a class, "name" that has no underlining, like this:

    a.name {
    text-decoration: none;
    }

    OR

    .name {
    text-decoration: none;
    }

    Then in instances where you want to invoke this style, do so like this:

    <a class="name" name="sometext"></a>

    Of course you can call the class anything you want if you don't want to call it "name."

  3. jayess
    Member
    Posted 6 years ago #

    Brilliant! Thanks for that, I have created a class called "name" as per your advice and it is solved! Thanks.

  4. Firas
    Member
    Posted 6 years ago #

    Ok, there are better ways of going about this :)

    First, don't use <a name> at all, how retro. Just put an id="xx" on the element you want to target (eg. <p id="car-rel">) and you can link to it the same way as you would to the value of the name attribute.

    Anyway, to answer your question: take the text-decoration: underline rule from the a {} selector to the :link, :visited, :hover, and :active selectors.

  5. jayess
    Member
    Posted 6 years ago #

    Very good! And very happy that I got two responses containing resolutions just the same hehe.

    I have deleted the a class reference then; and ended up removing the text-decoration:underline from the a selector.

    The id= etc idea was a little too advanced for me! I'm just a writer ;-)

    Thank-you both!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.