Categories
React Answers

How to set inline style of background color with React?

Spread the love

Sometimes, we want to set inline style of background color with React.

In this article, we’ll look at how to set inline style of background color with React.

How to set inline style of background color with React?

To set inline style of background color with React, we set the backgroundColor style.

For instance, we write

<a style={{ backgroundColor: "yellow" }}>yellow</a>

to set the backgroundColor of the link to 'yellow' inline with the style prop.

Conclusion

To set inline style of background color with React, we set the backgroundColor style.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *