What causes background
to take precedence over backgroundColor
in React inline-style?
In this scenario, the lack of a specified green background-color results in the background gradient with transparency transitioning into white rather than green within the transparent areas.
How can I prevent this behavior and make the transparency effective?
class App extends React.Component {
render() {
return (
<div style={{backgroundColor:"green", background: "radial-gradient(100% 100% at 0px 0px, rgb(230, 100, 101), transparent)"}}>
</div>
);
}
}
// Render it
ReactDOM.render(
<App />,
document.getElementById("react")
);
div {
width: 200px;
height: 200px;
}
<div id="react"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
The issue is resolved by setting the CSS externally, but it needs to function in React's inline style for dynamic applicability.