且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将背景图像添加到EJS文件

更新时间:2023-12-05 22:36:10

ejs文件

将此添加到您的css文件中

add this in your css file

body {
        width: 100%;
        align-items : center;
        height: 100%;
         

        /* Background image is centered vertically and horizontally at all times */
        background-position: center center;

        /* Background image doesn't tile */
        background-repeat: no-repeat;

        /* Background image is fixed in the viewport so that it doesn't move when 
        the content's height is greater than the image's height */
        background-attachment: fixed;

        /* This is what makes the background image rescale based
        on the container's size */
        background-size: cover;

        /* Set a background color that will be displayed
        while the background image is loading */
        background-color: green;
        overflow: hidden;

        /* Location of the image */
        background-image:url('images/introBackGround.jpg') ;
    }  

(删除所有块引用)

路由器文件

您必须添加它。

app.use(express.static(path.join(__dirname, 'public')));

文件夹

public
 └ images