仅支持ie8背景吗?
我使用了html代码标题类型,并为它放置了css。然后为它做一个背景。它在谷歌浏览器,Mozilla,Safari浏览器运行良好,但背景不起作用,即从标题8。仅支持ie8背景吗?
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>ASI India Travels</title>
<style>
html, body, div, span, object, iframe, article,
footer, header, hgroup, menu, nav, section, summary,
h1, h2, h3, h4, h5, h6, p,
time, mark, audio, video {
margin:0;
padding:0;
border:0;
outline:0;
vertical-align:baseline;
}
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display:block;
}
body {
background-color:#666666;
}
.container {
width:875px;
margin-left:auto;
margin-right:auto;
}
header{ }
#header {
background-color:#009966;
height:275px;
}
</style>
</head>
<body>
<header id="header">
<div class="container">
header
</div>
</header>
</body>
你可以请任何人解决这个问题吗?在此先感谢...
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>ASI India Travels</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
html, body, div, span, object, iframe, article,
footer, header, hgroup, menu, nav, section, summary,
h1, h2, h3, h4, h5, h6, p,
time, mark, audio, video {
margin:0;
padding:0;
border:0;
outline:0;
vertical-align:baseline;
}
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display:block;
}
body {
background-color:#666666;
}
.container {
width:875px;
margin-left:auto;
margin-right:auto;
}
header{ }
#header {
background-color:#009966;
height:275px;
}
</style>
</head>
<body>
<header id="header">
<div class="container">
header
</div>
</header>
</body>
您必须在文档中支持html5标记。在这种情况下,您使用的是一个html5元素的header
标签。
您可以通过访问this网站了解更多关于html5的信息。
你可以在IE8及其以下版本中设计HTML5标记。
Internet Explorer < 9不知道如何在 它无法识别的元素上呈现CSS。
你需要一个Javascript填充工具叫做html5shiv。
谢谢,这对我有效:) – IrishChieftain
这是因为你的<header>
标签。 您可以包含此JavaScript来的工作HTML5标签IE 8
<script type="text/javascript">
document.createElement('header');
</script>
希望这将有助于
这是可行的,但我只想这个表单html。我们如何识别css3。我不想使用Js。感谢所有。 – Vinay
你需要做两件事情:
- 添加脚本(Modernizr的),使这个IE8的html5元素。 You have to download the script
- 添加CSS使一个块级元素(你有媒体链接)
添加到您的<head>
<script src="js/modernizr-1.7.min.js"></script>
然后你就可以在你的CSS使用:
header{
background-color:#009966;
height:275px;
因为''在IE
Passerby