当前位置:网站首页>Two methods for full screen adaptation of background pictures, background size: cover; Or (background size: 100% 100%;)

Two methods for full screen adaptation of background pictures, background size: cover; Or (background size: 100% 100%;)

2022-07-08 01:07:00 Intelligent control and optimization decision Laboratory of Cen

background: #000 url(img1.jpg) no-repeat fixed center center;

background-size: cover;  perhaps (background-size: 100% 100%;)

          Pay attention to writing well background Then write background-size, Otherwise it will be useless , Bear in mind , I wasted more than an hour here

     

100% and cover The difference between the two is roughly as follows

          background-size in ,100% and cover Are used to enlarge or zoom the image to fit the entire container

background-size:100% 100%;--- Fill up in proportion to the container , Image distortion ;

 Insert picture description here

background-size:cover;--- Enlarge the background image to fit the element container , The scale of the picture is the same , But be careful , The part beyond the container may be cut off .

 Insert picture description here

          I personally feel that background-size:100%,100%; Better effect

          Original picture

 Insert picture description here

原网站

版权声明
本文为[Intelligent control and optimization decision Laboratory of Cen]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130549316562.html