Search
 
SCRIPT & CODE EXAMPLE
 

CSS

how to change image based on screen size

@media screen and (max-width: 767px){   
    #main-img{      
        content:url("img/mobile_homepage.jpg");
    } 
}

@media screen and (min-width: 768px) {      
    #main-img{      
       content:url("img/tablet_homepage.jpg");
     } 
} 
@media (min-width: 992px){      
      #main-img{        
          content:url("img/desktop_homepage.jpg");  
      } 
}
@media (min-width: 1200px) {    
     #main-img{         
         content:url("img/desktop_homepage.jpg");   
     } 
}
Comment

make image scale based on screen size

background-size: cover
Comment

PREVIOUS NEXT
Code Example
Css :: change image link css 
Css :: background image syntax in css if it in folder 
Css :: focus on input change label color 
Css :: before and after pseudo selectors 
Css :: css grid 
Css :: liste commandes disponibles linux 
Css :: transform css 
Css :: how to disable site anchor 
Css :: tailwind css colors not working 
Css :: create variable in css 
Css :: Script for free code camp test 
Css :: rendre une div scrollable 
Css :: attribute selectors in css 
Css :: css padding 4 values 
Css :: reset css simples 
Css :: resctrict css to apply on div 
Css :: css remove line from link 
Css :: align svg and text inside button 
Css :: css all flex properties 
Css :: min width css 
Css :: css nested scrollbars 
Css :: dark-mode 
Css :: ngrok host header change 
Css :: css animate absolute position 
Css :: display block 
Css :: how to add images on images css 
Css :: css position 
Css :: button slanted slide on hover 
Css :: css: custom font and color 
Css :: set default rem css 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =