One issue I am facing is with an anchor element within a <div>
. The anchor has conditional background styling, which seems to override the a:hover
style. Whether I have conditional or fixed coloring, removing the background-style from component.js
allows the hover effect from style.css
to work correctly.
My main question is how can I maintain the hover effect while also using conditional background-coloring?
Snippet from component.js:
<div>
<a href="#"
style={{
background: (day === 2) && "#f1f1f1"
}} />
</div>
Snippet from style.css:
div a {
display: block;
}
div a:hover {
background: blue;
}