2014-10-28 106 views
0

嗨,大家好,只是想知道为什么我不能让我的媒体查询缩小我的导航栏。我有以下的CSS:在X浏览器宽度崩溃导航栏@media查询不起作用

@media only screen and (min-device-width:1024px) 
{ 
    div.large-7.push-5.columns.last{ 
    height: emCalc(1px); 
} 
} 
@media only screen and (max-device-width: 745px){ 
    .top-bar .toggle-topbar.menu-icon a { 
    color: $steel; 
    height: 34px; 
    line-height: 33px; 
    padding: 0 25px 0 0; 
    position: relative; 
} 
    .top-bar .toggle-topbar.menu-icon a:after { 
    box-shadow: 0 10px 0 1px $steel, 0 16px 0 1px $steel, 0 22px 0 1px $steel; 
    content: ""; 
    display: block; 
    height: 0; 
    position: absolute; 
    right: 5px; 
    top: 0; 
    width: 16px; 
} 
} 
@media only screen and (max-device-width: 480px) { 

一切都会按计划在移动,但在台式机/笔记本电脑的浏览器窗口,它不会响应像我想的时候我缩围绕745px标记的浏览器。我不知道为什么,也无法在这个问题上找到任何帮助。如果您希望看到该网站的行动,它是www.omegadesignla.com。预先感谢真棒输入和upvotes。

回答

0

媒体查询通常应使用最小宽度和最大宽度而不是最小设备宽度和最大设备宽度,后两者由设备固定,而不管窗口大小如何。

+0

我试着取出“设备”,但它并没有区别 – Omegaman 2014-10-28 23:10:47

0

更改CSS规则,这一点:

@media only screen and (min-width:1024px) 
{ 
    div.large-7.push-5.columns.last{ 
    height: emCalc(1px); 
} 
} 
@media only screen and (max-width: 745px){ 
    .top-bar .toggle-topbar.menu-icon a { 
    color: $steel; 
    height: 34px; 
    line-height: 33px; 
    padding: 0 25px 0 0; 
    position: relative; 
} 
    .top-bar .toggle-topbar.menu-icon a:after { 
    box-shadow: 0 10px 0 1px $steel, 0 16px 0 1px $steel, 0 22px 0 1px $steel; 
    content: ""; 
    display: block; 
    height: 0; 
    position: absolute; 
    right: 5px; 
    top: 0; 
    width: 16px; 
} 
} 
@media only screen and (max-width: 480px) { 
+0

你只是删除了“设备”?我做到了这一点,但没有改变。 – Omegaman 2014-10-28 23:26:00

+0

这工作。我只是尝试了别的东西。 。 。 – 2014-10-28 23:30:32

+0

好的,但为什么它不能在我的网站上工作?你可以看看我的网站,看看? – Omegaman 2014-10-28 23:37:49