How to use media queries in css

后端 未结 3 1114
闹比i
闹比i 2020-12-06 03:28

I am very keen to use media queries in my CSS but i am confused to how to use it. I have stand

my queries requirement is

if screen width is 100 to 480 then d

相关标签:
3条回答
  • 2020-12-06 04:11

    The basic relies on using this kind of queries:

    @media (min-width: 768px) and (max-width: 979px) {
    /*here goes the exact changes you need to make in order to make 
    your site pretty on this range.*/
    }
    

    Please remember that when using responsive web design you should use percentages when possible also em for fonts.

    media queries are now available for IE. take a look in http://caniuse.com/#feat=css-mediaqueries when you can use them. A polyfil I been using with good results is response.js

    0 讨论(0)
  • 2020-12-06 04:14
    .class { /* default style */ }
    
    @media (min-width: 100px) and (max-width: 480px) {
     .class { /* style */ }
    }
    
    @media (min-width: 481px) and (max-width: 600px) {
     .class { /* style */ }
    }
    
    @media (min-width: 601px) and (max-width: 800px) {
     .class { /* style */ }
    }
    
    0 讨论(0)
  • 2020-12-06 04:29

    I believe something along the lines of:

    @media screen and (min-width: 100px) and (max-width: 480px)
    {
        /* Change main container '.wrapper' */
        .wrapper
        {
            width: 100px;
        }
    }
    
    @media screen and (min-width: 480px) and (max-width: 600px)
    {
        .wrapper
        {
            width: 480px;
        }
    }
    

    ..etc

    0 讨论(0)
提交回复
热议问题