【问题标题】:Relative-layout, Mobile version not displaying properly.. HTML/CSS相对布局,移动版显示不正确.. HTML/CSS
【发布时间】:2013-07-23 17:12:55
【问题描述】:

不寻常的问题,我只是无法弄清楚为什么会发生,基本上我尝试通过 responsinator 查看该网站 一切似乎都很好,在调整浏览器大小时它似乎也很好(即使是在移动设备上),但是在 iphone 上查看该网站时,它似乎根本没有听过媒体查询..

http://jsfiddle.net/z5jVJ/

在验证整个 css 时,我得到以下信息

Parse Error
@media only screen and (max-width: 600px) {

#container {
    margin: 0 auto;
    max-width: 85%;
    overflow: hidden;
}

nav #pull {
    position: absolute !important;
    top: 5px !important;
    left: 5px !important;
}

nav ul {  
    display: none;  
    height: auto;  
}  

nav a#pull {  
    text-align: left;
    margin-top: -3px;
    font-family: 'Oswald', sans-serif;
    font-weight: 300;
    font-size: 18px;
    display: block;  
    width: 90%;  
}  

nav a#pull:after {  
    background: url('nav-icon.png') no-repeat;   
    height: 1px; 
    display: block;
    position: absolute;  
    right: 15px;  
}

#mainHeader nav {
    text-align: center;
    min-height: 25px;
    height: 100%;
    width: 100%;
    border-bottom: 1px solid #dfdfdf;
}

#mainHeader nav ul li {
    padding: 10px;
    margin-top: 23px;
    font-size: 16px;
}

#mainHeader nav ul li a {
    padding: 0px;
}

#mainHeader nav a:hover {
    color: #dfdfdf;
}

#mainHeader ul {
    list-style: none;
    margin: 0 auto;
    height: 53px;
}

#mainHeader nav ul li a {
    padding: 0px 0px;
}

.banner .label {
    margin-bottom: 5px;
    width: 50%;
    -webkit-border-top-right-radius: 5px;
    -webkit-border-bottom-right-radius: 5px;
    -moz-border-radius-topright: 5px;
    -moz-border-radius-bottomright: 5px;
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;    
}

.banner .category {
    text-align: right;
    min-width: 96.5%;   

}

#mainContent { 
    float: right;
    width: 100%;
}

#mainContent img {
    width: 96.5%;
}

.article {
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;   
}

#footer { 
    height: 50px;
}
    }

有什么想法吗?

【问题讨论】:

  • 我建议 not 使用
  • 您将视口定义为什么?
  • 那是视口,我刚刚删除了导航标签并更改了 CSS 但仍然没有运气
  • 尝试将您的视口更改为此
  • 哈哈是的@box 可能会尝试将媒体查询更改为这个......仅媒体屏幕和(最大设备宽度:480px)

标签: javascript html css layout


【解决方案1】:

尝试更改您的媒体查询,验证 CSS 后出现“解析错误”。

所以改变这个:

@media only screen and (max-width: 600px)

到这里:

@media only screen and (max-device-width: 480px)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-07-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-01
    • 1970-01-01
    相关资源
    最近更新 更多