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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM