Inline CSS in React Js
Copy Below Code
View As A Text File
Show Text Only
Show API
Edit Code
===== Dynamic Method ===
- Import Image
=== > import car from './images/car.png'
=== > <div styles={{ backgroundImage:`url(${car})` }}>
<h1>This is red car</h1>
</div>
==== Static Method ===
style={{
backgroundImage: "url(" + "assets/img/slider/slide1.jpg" + ")",
backgroundPosition: 'center',
backgroundSize: 'cover',
backgroundRepeat: 'no-repeat'
}}