Change styling on hover semantic-ui-react components

DORRITO picture DORRITO · Feb 17, 2018 · Viewed 11.7k times · Source

if I set up a className for certain components like

<Segment className="Change" color='blue' inverted></Segment>

and in my css I use

.Change:hover{
  background-color: black; //or any other change on hover
}

nothing is overriden on the hover.

I have also noticed there are many other components that refuse changes of mine, seemingly randomly. One semantic component will let me change a width the next will not. Is the cause from the same issue? How do I override the color on a hover?

Answer

fyasir picture fyasir · Feb 17, 2018

After reviewing the source code of Segment Component (github), I found it has two default classes: segment and ui. In addition, you used two props color=blue and inverted. So I would recommend using the following code.

.ui.segment.blue.inverted.Change:hover {
  background-color: black !important;
}

Working DEMO