【发布时间】:2016-02-24 23:53:47
【问题描述】:
我正在尝试使我的网站可移动访问。我遇到的问题是nav。我相信这与nav 上使用的类有关。所以我想做的是在使用移动设备时删除该类。
我在媒体查询中使用了它,并更改了许多内容以使其在移动设备上看起来正确。我读到可以使用
删除一个类$( "p" ).removeClass( "myClass yourClass" );
我相信我会是
$( "nav" ).removeClass( "navigation" );
但是当放入样式表并通过 css 验证器时,我得到了
Lexical error at line 104, column 4.
Encountered: "(" (40), after : "$" ( "nav" ).removeClass( "navigation" );
我不知道如何解决这个问题,或者即使我可以解决这个问题。我读过的其他页面说这是不可能的,所以我得到了相互矛盾的信息。
这是我试图发布代码。 我的 CSS 中的所有内容都会影响我的导航。
nav ul { list-style-type: none;
margin: 0;
padding: 0; }
header nav a { text-decoration: none;
padding: 10px;
display: block;
background-color: #a8e6a8;
border-bottom: 1px solid #228B22; }
nav a:link { color: #228B22; }
nav a:visited { color: #568b22; }
nav a:hover { color: #869DC7;
background-color: #EAEAEA; }
.navigation { float: right;
width: 200px;
font-weight: bold;
letter-spacing: 0.1em; }
这是我未完成的媒体查询。
@media only screen and (max-width: 1024px) {
body { margin: 0; padding: 0; background-color: #fff; }
#wrapper { width: auto; min-width: 0; margin: 0; }
h1 { margin: 0; text-align: center; font-size: 2em; line-height: 200%; }
nav { float: none; width: auto; }
nav li { display: inline-block; }
nav a { padding: 1em; border-style: none; font-size: 1.2em; }
nav ul { text-align: center; padding: 0; margin: 0; }
main { margin: 0; padding: 0 1em; font-size: 90%; }
dd { margin-bottom: 1em; }
footer { margin: 0; }
.navigation { float: none;
width: auto;
letter-spacing: 0.1em; };
}
【问题讨论】:
-
欢迎来到 stackoverflow,Scotty! "How to ask?" 和 What topics can I ask about here?" 应该为您提供有关如何使其“视觉上令人愉悦”的所有信息。
-
对于反对者来说,这个问题似乎描述得很好,只是被缺乏格式知识的新提问者隐藏了。
-
我不知道那次否决票是怎么发生的,但我修好了。
标签: css html class media-queries stylesheet