1

I have a css file like this in a gtk4 application. I am expecting the GtkButton to change its color when the mouse hovered over it.

headerbar button {
    border-radius: 20px;
    border-style: none;
    border: solid 1px red;
    background-color: transparent;
    color: skyblue;
}

headerbar button :hover {
    border: solid 1px lightgreen;
    color: magenta;
}

However, the result I get is:
The button will allways have a red border. And the properties I set in button :hover is applied to button's label instead
screenshot of the button
The blue square is my button :hover css properties. Did I do something wrong?

2
  • Should there be a space between button and :hover? Commented Jul 14 at 10:39
  • I removed the space before :hover and it works now. Thank you Commented Jul 14 at 10:42

1 Answer 1

0

Assuming gtk CSS is just regular CSS, you can't have a space between the selector and the pseudo-class (and have it work as you expect).

button:hover is hover for the button class

button :hover is hover for children of button.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.