Reputation: 1250
quick and simple question, I'm trying to add a div with a background-image in *.ejs page file.
<style>
.signPage{
background-image: url("//back.jpg");
width: 98%;
height: 98vh;
top: 1%;
right: 1%;
position: fixed;
border-radius: 20px;
}
the image and the ejs are in the same directory. thanks
Upvotes: 1
Views: 3726
Reputation: 1
You have to provide the path from the css file in which you have specified the rule.
For example: if the image is in folder public/images
and the css file is in folder public/css,
then you should provide like this
-- ../images/image-name.image-extension
In short - You have to provide a path relative to css to image
Upvotes: 0
Reputation: 1007
you need to first provide a static path in app.js and then put background image at public/images to use it just
background-image: url("images/back.jpg");
app.use(express.static(__dirname+'/public'));
Upvotes: 2