Jade engine template / How to set a background image

I would like to set a background image to my HTML page with Jade . Does anyone know how to achieve this?

thanks

+4
source share
2 answers

The background image is set in the CSS page. And this has nothing to do with Jade.

So, on the CSS page:

body { background-image: url(/images/img1.jpg); } 

Or using a class that is then assigned to one of the jade pattern elements:

 .bkimg { background-image: url(/images/img1.jpg); } 

and jade:

 body.bkimg p this is a fine body 

The same applies to any type of element.

+3
source

You can set the style attribute as follows:

 div(style='background-image: url(/myImage.jpg);') 

However, you should not use the inline style. Separate your content from design - keep html and css in separate files.

Read more about attributes in jade here .

+14
source

Source: https://habr.com/ru/post/1481989/


All Articles