HTML5元素可在Chrome中使用,但不能在Safari或Firefox中使用? [英] HTML5 elements working in Chrome but not Safari or Firefox?

查看:279
本文介绍了HTML5元素可在Chrome中使用,但不能在Safari或Firefox中使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用HTML5元素,在我正在开发的项目中,css似乎在Chrome中正常工作。但是,它似乎并不工作在Safari或Firefox(我没有测试IE,但我想象的是一样的),页面布局是所有的地方。

I'm using the HTML5 elements and in a project i'm working on and the css seems to be working fine in Chrome. However, it doesn't appear to be working in Safari or Firefox (I haven't tested IE, but I'd imagine it's the same), and the page layout is all over the place.

任何想法为什么会是这样?我知道Firefox和Safari都支持这些元素,Safari是基于webkit的,比如Chrome,所以我不知道是什么问题。

Any ideas why this may be? I know Firefox and Safari both support these elements, and Safari is webkit-based like Chrome, so I can't figure out what the problem is.

可以在此处查看网页。 {website link not available}

You can see the webpage here. {website link not available}

推荐答案

Safari和Firefox对HTML5细分元素具有相同的 (看到你的演示页面后,我猜这些是你正在谈论的元素):他们可以样式,但你必须设置 display:block;

Safari and Firefox have the same level of ‘support’ for HTML5 sectioning elements (after seeing your demo page, I’m guessing these are the elements you’re talking about): they can be styled, but you have to set display: block; implicitly.

aside, article, section { display: block; }

将此规则添加到CSS将解决此问题。

Adding this rule to your CSS will solve the problem.

为了使这些元素在IE中可以样式化,你只需要使用HTML5 shim / shiv。在您的< head> 中输入以下HTML:

To make these elements stylable in IE, you just need to use the HTML5 shim/shiv. Put the following HTML in your <head>:

<!--[if lt IE 9]>
 <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

这篇关于HTML5元素可在Chrome中使用,但不能在Safari或Firefox中使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆