Home >Web Front-end >HTML Tutorial >How to display different pictures according to different screen resolutions? _html/css_WEB-ITnose
If the screen width is less than 1400, use picture 1.
If it is larger, use picture 2, and specify the width of the picture to be the width of the screen.
Define window.screen.width and pass it to the background output.
<script> <br> if(window.screen.width<1400){ <br /> document.write("<img src='img1.png' style='width:100%' text-align='center'>"); <br> }else{ <br> document.write("<img src='img2.png' style='width:100%' text-align='center'>"); <br> } <br> </script>