在html 5增加了新元素header、footer,測試過發(fā)現(xiàn)ie不能解析html 5新增的元素。
代碼如下:<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>無標題文檔</title>
<style type="text/css">
<!--
*{
margin:0;
padding:0;
}
header{
background:#090;
font-weight:bold;
position:absolute;
top:10px;
}
footer{
background:#f90;
font-weight:bold;
position:absolute;
bottom:10px;
}
-->
</style>
</head>
<body>
<header>這里是頂部</header>
<footer>這里是尾部</footer>
</div>
</body>
</html>
用自定義標簽可以解決瀏覽器兼容的問題
代碼如下:<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns:layout>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>自定義html標簽</title>
<style type="text/css">
<!--
*{
margin:0;
padding:0;
}
layout/:header{
background:#090;
font-weight:bold;
position:absolute;
top:10px;
}
layout/:footer{
background:#f90;
font-weight:bold;
position:absolute;
bottom:10px;
}
-->
</style>
</head>
<body>
<layout:header>這里是頂部</layout:header>
<layout:footer>這里是尾部</layout:footer>
</body>
</html>
|
新聞熱點
疑難解答