WordPress.org

Forums

How to have underline for a link with onmouseover function (8 posts)

  1. elsatrento
    Member
    Posted 5 years ago #

    I made some experiments, and I put "text-decoration:none" in the style section of links in tinymce to eliminate the fixed underline with links, and it works. But I'd also want the underline effect when I mouseover on a link. What code should I put in the onmouseover section? I tried a lot of things, but nothing :(

  2. esmi
    Forum Moderator
    Posted 5 years ago #

    Try text-decoration:underline;

  3. elsatrento
    Member
    Posted 5 years ago #

    Tried already, no results :(

    By the way, the url: elsatrento.org

  4. esmi
    Forum Moderator
    Posted 5 years ago #

    Is this to remove/add underlines in TimyMCE or on the displayed site. If it's the latter, you need to edit your theme's stylesheet.

  5. elsatrento
    Member
    Posted 5 years ago #

    What do you mean with "displayed site"? Anyway, I want this effect for a text widget, that's why I compose the text in tinymce and then I copy the html and past it in the text widget. It works very well, but with "onmouseover" I don't know what to write :(

  6. esmi
    Forum Moderator
    Posted 5 years ago #

    You'd be better off applying a class to the links in your Text widget and than adding that class to your theme's stylesheet.

  7. Mark / t31os
    Moderator
    Posted 5 years ago #

    As esmi said, give your links(or the containing element) a class, then apply CSS to the links..

    Here's an example you can use..

    Example HTML: Code that would go in the widget

    <div class="mydiv">
      <a href="#example">Example link 1</a>
      <a href="#example">Example link 2</a>
    </div>

    Example CSS: Code that would go into your stylesheet

    .mydiv a { text-decoration:none }
    .mydiv a:hover { text-decoration:underline }
  8. elsatrento
    Member
    Posted 5 years ago #

    Seems too much complicated for my goals. Thanks anyway :)

Topic Closed

This topic has been closed to new replies.

About this Topic