The body background image adapts to the window of the webpage, and the pro-test is effective!

Directly on the code (css):

html {
    
    
    height: 100%;
    width: 100%;
}

body {
    
    
    
    background-image: url(pic/BG2.jpg);
    background-repeat: no-repeat;
    background-size: 100% 100%;
}

You must first specify the width and height of the html before you can match the background in the body!
Effect preview:
insert image description here
insert image description here
there is a problem: the picture will be stretched and lose its original ornamental value!

Guess you like

Origin blog.csdn.net/NEXT00/article/details/128854082