Html-根据不同的分辨率设置不同的背景图片

@media only screen and (min-width1024px)     //当分辨率width >= 1024px 时使用1.jpg作为背景图片
{            
.bg{
  background:url(./images/1.jpg) no-repeat;
 }
}
@media only screen and (min-width400pxand (max-width1024px)    //当分辨率400px width 1024px 时使用2.jpg作为背景图片
{  
   .bg{
           background:url(./images/2.jpg) no-repeat;
        }
}
@media only screen and (mmax-width400px)    //当分辨率width =< 400px 时使用3.jpg作为背景图片
{   
     .bg{
             background:url(./images/3.jpg) no-repeat;
          }
}
原文地址:https://www.cnblogs.com/huanhuan55/p/9789301.html