简体   繁体   English

CSS不适用于IE和Firefox,但可在Chrome中使用

[英]CSS not working with IE and Firefox, but works in Chrome

Site jgimprinters.com loads and works fine in Chrome, but not in IE or Firefox. 网站jgimprinters.com可以在Chrome浏览器中加载并正常运行,但不能在IE或Firefox中运行。 I have verified that IE downloads the style sheet, however it does not apply a lot of the styles. 我已经验证IE下载了样式表,但是它并没有应用很多样式。 For instance, in IE, the menu button that is supposed to be hidden in full size is showing and all blown out (too big), none of the menu styling is working, background colors of several things is not working. 例如,在IE中,原本应该以全尺寸隐藏的菜单按钮正在显示,并且全部弹出(太大),菜单样式均不起作用,几件事的背景色不起作用。 Although the stylesheet is being seen by IE, it is not applying the styles. 尽管IE可以看到样式表,但它没有应用样式。

Any help would be appreciated. 任何帮助,将不胜感激。

Thanks 谢谢

EDIT: snippets that arent working - for starters there is the entire nav - and the header is missing from under the nav 编辑:片段不能正常工作-对于初学者来说,整个导航-和标题从导航下面丢失

 #nav-wrapper{ max-width:900px; margin:0 auto; } #nav{ list-style:none; } #nav li{ float:left; } #nav li a{ webkit-border-radius: 6px 6px 0 0; -moz-border-radius: 6px 6px 0 0; border-radius: 6px 6px 0 0; padding: 0 17px; margin: 0 auto; position: relative; display: block; height: 30px; cursor: pointer; text-decoration: none; color: #FFFFFF; line-height: 30px; text-align: center; font-size:12px; font-weight:bold; } #nav li a.active, #nav li a.better-active{ background: #EDEDED; color: #5D5F5D; } #nav li a:hover{ background:#5D5F5D; color:#ffffff; } #menu-button{ display:none; width:36px; cursor:pointer; } #menu-button img{ margin:0px; } #head-wrapper{ height:150px; background:url('/wp-content/uploads/2015/02/header.png') no-repeat; background-position:center; width:100%; display:block; } #head-inner{ width:100%; max-width:900px; margin:0 auto; } #logo{ margin-left:30px; float:left; } #head-right{ float:right; width:270px; margin-top:30px; margin-right:15px; } #callout{ font-size: 14px; font-family: Verdana, Geneva, Arial, Helvetica, Sans-Serif; font-weight: bold; font-style: normal; text-decoration: none; text-transform: none; font-variant: normal; text-align: left; color: #ED1D2E !important; width:280px; } #phone{ font-size: 30px; font-family: 'Trebuchet MS', Arial, Helvetica, Sans-Serif; font-weight: bold; font-style: normal; text-align: left; vertical-align: middle; color: #000000 !important; text-decoration:none; } 

All of that is pretty much being ignored by IE and Firefox. IE和Firefox几乎忽略了所有这些。

Looks like: 看起来像: IE萤幕撷取画面

Should look like: 应该看起来像: 在此处输入图片说明

There's a syntax error in your styles.css file on line 385, which Chrome seems to fix for you while other browsers don't. 第385行的styles.css文件中存在语法错误,Chrome似乎可以为您解决,而其他浏览器则无法解决。

… url(/wp-content/uploads/2015/02/nav.png') …

There's a closing apostrophe which has not been opened. 右撇号尚未打开。 All CSS after that isn't parsed. 之后的所有CSS均不会解析。

How did I find out? 我怎么知道的?

I opened the stylesheet in my favorite editor and noticed that after line 385 everything was yellow—which is the color for strings. 我在喜欢的编辑器中打开了样式表,并注意到在385行之后,所有内容均为黄色,这是字符串的颜色。

崇高截图

However, validating the CSS would also have helped as it also found the error (among others): 但是,验证CSS也会有所帮助,因为它还会发现错误(以及其他错误):

386 #main-nav   Value Error : background top is not a color value ) no-repeat, …

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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