0

I was recently working on a WordPress project when I came across the underlined text in the picture below. It remains underlined until I hover over it, then the underline disappears.

Button BEFORE hovering over it

Button BEFORE hovering over it

Button AFTER hovering over it

Button AFTER hovering over it

I tried to change basically all settings regarding both the general buttons look and the specific design of the one in the website header.

I'm using the latest version of WordPress running the latest version of the Astra theme.

This is the first time I have encountered this problem, although I've worked on many other websites before and it always worked as expected.

Any Ideas?

3
  • 2
    It's not possible to help you if you do not post the code that you are using. Please check: stackoverflow.com/help/minimal-reproducible-example
    – m4n0
    Commented Nov 15, 2022 at 8:26
  • Sorry, this is my first question. What code should I post in this case? Because I'm just using the visual editor.
    – Giacomo
    Commented Nov 15, 2022 at 8:46
  • 1
    Well, you need to make use of Chrome Dev Tools or the developer tools of your browser to inspect the code. It can also be helpful if you can show your demo site but people here would prefer code through the snippet instead of a demo link which may expire.
    – m4n0
    Commented Nov 15, 2022 at 8:52

2 Answers 2

0

As it was kindly suggested by m4no I dug a bit in the Chrome Dev Tools and found the CSS that was causing the underlining:

a:where(:not(.wp-element-button)) {
   text-decoration: underline;
}

And changed it to

a:where(:not(.wp-element-button)) {
    text-decoration: none;
}

in the Additional CSS which solved the problem.

0

It can be disabled via theme.json

{
  "$schema": "http://schemas.wp.org/trunk/theme.json",
  "version": 2,
  "styles": {
    "elements": {
      "link": {
        "typography": {
          "textDecoration": "false"
        }
      }
    }
  }
}

Note: I didn't come up with this solution, it was suggested by user straightvisions-matthias-bathke in another forum.

Not the answer you're looking for? Browse other questions tagged or ask your own question.