CSS 在 IE 中完全搞砸了(就像一半的 CSS 没有加载)
我有一个网站在 IE 中完全搞砸了,我想知道是否有人可以帮助我找出问题所在。
有问题的页面是 http://eksai.com/testing/
当我在 IE 中打开它时,它就像一半CSS 代码未加载。字体颜色是相同的,没有列,等等。我已经将 CSS 文件削减到最低限度,试图找出导致此问题的原因......但我仍然无法让它正常工作。
谁能帮我找出是什么原因造成的?
这是 CSS 文件:
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}
a img{border:none}
@font-face{font-family:"agb";src:url("../fonts/b.eot");src:url("../fonts/b.eot?#iefix") format("eot"),url("../fonts/b.ttf") format("truetype")}
body, input,textarea,select,button{font:normal 16px "helvetica neue",helvetica,arial,sans-serif;line-height:24px}
h1{font:48px/60px "helvetica neue",helvetica,arial,sans-serif;font-weight:normal;margin-bottom:20px}
h2{font-size:26px;line-height:30px;margin-bottom:5px;font-weight:bold}
h3{margin-bottom:5px;font-size:20px;line-height:25px;font-weight:normal;color:#3a3e42}
h4{font-weight:bold}
a{outline:0;text-decoration:none;color:#2d81c5}
html{background:#d5d8db url(../images/public/body.png) fixed;background:url(../images/public/body-gradient.png) repeat-x fixed,#d5d8db url(../images/public/body.png) fixed;color:#52585d;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased}
.wrapper{position:relative;width:1020px;margin:30px auto 100px;padding:0 2px}
.page{position:relative;background:#fff url(../images/public/page.png);-moz-box-shadow:0px 0px 3px rgba(0,0,0,0.5);-webkit-box-shadow:0px 0px 3px rgba(0,0,0,0.5);-o-box-shadow:0px 0px 3px rgba(0,0,0,0.5);box-shadow:0px 0px 3px rgba(0,0,0,0.5);margin-bottom:20px;min-height:400px}
.page:after{content:" ";position:absolute;bottom:-8px;left:-1px;width:1022px;height:8px;text-indent:-119988px;overflow:hidden;text-align:left;background-image:url('../images/public/page-shadow.png');background-repeat:no-repeat;background-position:0 0}
.platter-section{padding:20px 60px 0px 20px;}
.main-nav{height:74px;background:#fff;-moz-box-shadow:rgba(0,0,0,0.1) 0 1px;-webkit-box-shadow:rgba(0,0,0,0.1) 0 1px;-o-box-shadow:rgba(0,0,0,0.1) 0 1px;box-shadow:rgba(0,0,0,0.1) 0 1px}
.main-nav .logo{position:absolute;top:18px;left:24px;display:block;width:152px;height:40px}
.main-nav .actions{position:absolute;top:20px;right:25px}
.hang{ background-image: url("../images/hang.png"); background-position: 0 0; background-repeat: no-repeat; height: 284px; left: 180px; overflow: hidden; position: absolute; text-align: left; text-indent: -119988px; top: -46px; width: 300px; }
.actions {z-index: 2;}
h1{font-size:60px;line-height:64px;margin:20px 0}
.alpha{float:left;width:474px; color:#ff0000;}
.beta{color:#fff000; border-left: 1px solid rgba(0, 0, 0, 0.1); float: left; padding-bottom: 20px; padding-top: 159px; position: relative; width: 300px;}
.signup-section-full-width{clear:both;}
I have a site that gets completely screwed up in IE, and I was wondering if anyone could help me track down what's wrong with it.
The page in question is http://eksai.com/testing/
When I open it in IE it's like half the CSS code didn't get loaded. Font colors are the same, there are no columns, etc. I've cut the CSS file to a minimum trying to figure out what's causing this...but I still can't get it to work right.
Can anyone help me figure out what's causing it?
here is the CSS file:
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}
a img{border:none}
@font-face{font-family:"agb";src:url("../fonts/b.eot");src:url("../fonts/b.eot?#iefix") format("eot"),url("../fonts/b.ttf") format("truetype")}
body, input,textarea,select,button{font:normal 16px "helvetica neue",helvetica,arial,sans-serif;line-height:24px}
h1{font:48px/60px "helvetica neue",helvetica,arial,sans-serif;font-weight:normal;margin-bottom:20px}
h2{font-size:26px;line-height:30px;margin-bottom:5px;font-weight:bold}
h3{margin-bottom:5px;font-size:20px;line-height:25px;font-weight:normal;color:#3a3e42}
h4{font-weight:bold}
a{outline:0;text-decoration:none;color:#2d81c5}
html{background:#d5d8db url(../images/public/body.png) fixed;background:url(../images/public/body-gradient.png) repeat-x fixed,#d5d8db url(../images/public/body.png) fixed;color:#52585d;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased}
.wrapper{position:relative;width:1020px;margin:30px auto 100px;padding:0 2px}
.page{position:relative;background:#fff url(../images/public/page.png);-moz-box-shadow:0px 0px 3px rgba(0,0,0,0.5);-webkit-box-shadow:0px 0px 3px rgba(0,0,0,0.5);-o-box-shadow:0px 0px 3px rgba(0,0,0,0.5);box-shadow:0px 0px 3px rgba(0,0,0,0.5);margin-bottom:20px;min-height:400px}
.page:after{content:" ";position:absolute;bottom:-8px;left:-1px;width:1022px;height:8px;text-indent:-119988px;overflow:hidden;text-align:left;background-image:url('../images/public/page-shadow.png');background-repeat:no-repeat;background-position:0 0}
.platter-section{padding:20px 60px 0px 20px;}
.main-nav{height:74px;background:#fff;-moz-box-shadow:rgba(0,0,0,0.1) 0 1px;-webkit-box-shadow:rgba(0,0,0,0.1) 0 1px;-o-box-shadow:rgba(0,0,0,0.1) 0 1px;box-shadow:rgba(0,0,0,0.1) 0 1px}
.main-nav .logo{position:absolute;top:18px;left:24px;display:block;width:152px;height:40px}
.main-nav .actions{position:absolute;top:20px;right:25px}
.hang{ background-image: url("../images/hang.png"); background-position: 0 0; background-repeat: no-repeat; height: 284px; left: 180px; overflow: hidden; position: absolute; text-align: left; text-indent: -119988px; top: -46px; width: 300px; }
.actions {z-index: 2;}
h1{font-size:60px;line-height:64px;margin:20px 0}
.alpha{float:left;width:474px; color:#ff0000;}
.beta{color:#fff000; border-left: 1px solid rgba(0, 0, 0, 0.1); float: left; padding-bottom: 20px; padding-top: 159px; position: relative; width: 300px;}
.signup-section-full-width{clear:both;}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应用样式的许多元素都是 HTML5 - IE8 及更低版本,无法将它们识别为有效、块级或可样式化。
对于旧版本的 Firefox,您只需要执行以下操作:
对于旧版本的 IE,在 head 中使用以下内容:
Many of the elements your applying styles to are HTML5 - IE8 and below don't recognize them as valid, block-level, or stylable.
For old versions of Firefox, you just need to do stuff like:
For old versions of IE, use this in the head:
仅供参考,您有许多 CSS 错误。
http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Feksai.com%2Ftesting%2Ffiles%2Fpublic.css&profile=css21&usermedium=all& warning=1&vextwarning=&lang=en
编辑:
您还使用 HTML5 元素,所以您可能想要包括像 Modernizr 这样的东西,它将使 HTML5 适应下层浏览器。
FYI, you have a number of CSS errors.
http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Feksai.com%2Ftesting%2Ffiles%2Fpublic.css&profile=css21&usermedium=all&warning=1&vextwarning=&lang=en
EDIT:
You're also using HTML5 elements, so you might want to include something like Modernizr, which will adapt HTML5 to downlevel browsers.
IE8 及更低版本不支持默认在 HTML5 中使用的未知元素的 CSS(尽管 IE9 中没有模糊)。
但是,如果您使用 JS document.createElement 创建具有相同标记名的元素,IE 将神奇地识别出那些以前未知的元素。请参阅此处: http://ejohn.org/blog/html5-shiv/
所以使用创建 HTML5 虚拟元素的脚本,您可以继续。
http://remysharp.com/2009/01/07/html5-enabling-脚本/
IE8 and below do not support CSS for unknown elements which you use in HTML5 by default (no fuzz in IE9 though).
But if you create a element of the same tagname with JS document.createElement, IE will magically become aware if those previously unknown elements. See here: http://ejohn.org/blog/html5-shiv/
So use a script which creates dummy elements of HTML5 and you can go on.
http://remysharp.com/2009/01/07/html5-enabling-script/