SPFx Webpart: Reference images in css?

Copper Contributor

Hey there


I'm very new to SPFx webpart development and I'm just trying a few things.

How do you correctly reference images in css? E.g. background-images.


I created a property where the user can add a URL to that background image, but I don't know how to access those properties within css.


Does anyone know how to achieve this?


2 Replies
best response confirmed by Fabian Ackeret (Copper Contributor)

Hi Fabian


You could use the property value on the React code (not CSS) and create that specific style there.

See an example here:


hope this helps

thanks :)