2016-08-21 9 views
-1

私はmin-width:368px;をデスクトップモードで使用していますが、それ以降はメディアクエリを使用しているので、max-width:368px(モバイルとタブレット用)に変換していますが、動作しません。それは値ではないmin-width値を取っています。なぜ?。CSS3:最大幅と最小幅

例:

min-width: 368px;(desktop); 
max-width: 368px;(mobile, tablet); 

答えて

0

これを試してみてください。

@media screen and (max-device-width: 480px) and (orientation: portrait){ 
/* some CSS here */ 
} 

/* #### Mobile Phones Landscape #### */ 
@media screen and (max-device-width: 640px) and (orientation:landscape){ 
/* some CSS here */ 
} 

/* #### Mobile Phones Portrait or Landscape #### */ 
@media screen and (max-device-width: 640px){ 
/* some CSS here */ 
} 

/* #### iPhone 4+ Portrait or Landscape #### */ 
@media screen and (min-device-width: 320px) and (-webkit-min-device-pixel-ratio: 2){ 
/* some CSS here */ 
} 

/* #### iPhone 5 Portrait or Landscape #### */ 
@media (device-height: 568px) and (device-width: 320px) and (-webkit-min-device-pixel-ratio: 2){ 
/* some CSS here */ 
} 

/* #### iPhone 6 and 6 plus Portrait or Landscape #### */ 
    @media (min-device-height: 667px) and (min-device-width: 375px) and (-webkit-min-device-pixel-ratio: 3){ 
    /* some CSS here */ 
    } 

    /* #### Tablets Portrait or Landscape #### */ 
    @media screen and (min-device-width: 768px) and (max-device-width: 1024px){ 
    /* some CSS here */ 
} 

/* #### Desktops #### */ 
@media screen and (min-width: 1024px){ 
    /* some CSS here */ 
}