0

How to write inline CSS in react.js

<div className="p-3" style={{backgroundImage: linear-gradient(to right top,#FB0712,#124FEB)}}>

getting an error(Error: error: Expected ',', got 'right') with the above code

1
  • 2
    You need to wrap linear-gradient(to right top,#FB0712,#124FEB) with quotes to make it a valid string: "linear-gradient(to right top,#FB0712,#124FEB)" Commented Mar 2, 2022 at 17:14

1 Answer 1

1

I had used something like below and it worked for me.

<div style={{backgroundImage: `linear-gradient(to right top,#FB0712,#124FEB)`, height: '20px', width: '20px'}}/>
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.