how to set viewport so it is 380x800 or 800x380 depending on orientation?

后端 未结 3 1164
北荒
北荒 2020-12-20 07:52

The meta tag \"viewport\" lets me set up the initial scale for a website, but this can get weird if the user then flips the orientation of the device.

For example, i

3条回答
  •  一整个雨季
    2020-12-20 08:35

    Use media queries for different screen sizes and orientation.

        
          
            
            
            
            
            
          
          
        
    

    First stylesheet link applies on all devices in portrait mode.
    Second stylesheet applies on devices with maximal width 500px when orientation is landscape
    and last stylesheet applies on devices with width bigger then 500px and orientation landscape.

    You can add more stylesheets for each combination you want.

    Here is documentation to media queries: W3C Media Queries
    and good tutorial: How To Use CSS3 Media Queries To Create a Mobile Version of Your Website

提交回复
热议问题