How to define background image in vue style block?
See original GitHub issueHow do you reference an image in your src/assets/images
folder in your style in your vue component?
This is not working… The doc suggests moving the image to the static folder… but why would I want two images folders in my project?
<style lang="stylus">
.help
background-image url('/assets/images/help.png')
</style>
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
How to add a Background Image in Vue.js - Reactgo
In this tutorial, we are going to learn about different ways to add a backgroundImage in the vue app by using inline styles....
Read more >How to add a background image in Style Tag in Vuejs - Medium
After you have created your Vuejs project, you need to add a background image. ... However, adding it in the App.vue file, below...
Read more >Vue Bootstrap 5 Background Image - examples & tutorial
Learn how to create a responsive background image with the newest Bootstrap 5 and Vue 3. Many examples and ready-to-use solutions.
Read more >Vue.js data-bind style backgroundImage not working
Within a Vue component, it worked for me just to say v-bind:style="{ 'background-image': url(image) }" , but outside of a component (just on...
Read more >VueJS background image URL – Dev Bay – front-end tips
I will show you in this article how to set in Vuejs the background image URL to display right content in dynamic way....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello @jamelt can you please try this line of code
background-image: url(~@/assets/images/name-of-image.png)
?I had some similar issue with images via CSS and this code above solved my problem, I hope it will also solve yours.
I know this is closed, but this definitely needs to be documented. I lost so much time looking into a way to reference an image in the assets folder directly in CSS.