码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2018-10-15 11:50:32      阅读:272      评论:0      收藏:0      [点我收藏+]

标签:round   lin   c11   span   class   style   min   images   背景图   

@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;
          }
}

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

标签:round   lin   c11   span   class   style   min   images   背景图   

原文地址:https://www.cnblogs.com/huanhuan55/p/9789301.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!