0π
β
in front of url put this: ./
and put the path in quotes (''
) like below:
.user-element {
background-image: url('./assets/icons/user-icon.svg');
}
If again it does not work then it means that the path is wrong
But as i can see in your question,you say that the icon is in assets/icon/user-icon.svg
but in css code you are using assets/icons/user-icon.svg
so the path it is wrong.Try to use the below code:
.user-element {
background-image: url(./assets/icon/user-icon.svg);
}
0π
With this kind of URL, just a path, the browser will prepend the scheme, server and port of the current page.
To access local filesystem try the file
scheme.
Source:stackexchange.com