简体   繁体   中英

@media screen css property doesn't respond?

My @media screen and (max-device-width: 640px) doesn't seem to respond. I also put the

<link rel="stylesheet" type="text/css" href="css/mobile.css"/>

and the

<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0" />

in my Index.html.

I only have this in my mobile.css:

 @media screen and (max-device-width: 640px)
 {
 #navbar {
     height: 11%;   
     }
 }

What do I miss? I work btw in dreamweaver cs4.

max-device-width and/or min-device-width needs an actual device to take effect, to debug your code on desktop you need to use:

@media screen and (max-width: 640px) {

  #navbar {
    height: 11%;    
  }

}

Try Device Emulator in Chrome Browser ,

if you develop for mobile devices, but don't have one to test on, It provides presets of existing devices (iPhone, HTC, Google...) and allows to edit resolution, orientation etc.

i'm think this...

 #navbar {
     height: 11%;   
     max-height:11%;
     }

so it never going to revase the max height

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM