用自定义html标签让IE支持html5新增元素

时间:2011-03-17 16:10:00 

在html 5增加了新元素header、footer,测试过发现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>

标签:浏览器,兼容,html5
0
投稿

猜你喜欢

  • Access报错:文件共享锁定数溢出

    2009-03-21 18:32:00
  • win7 x64系统中安装Scrapy的方法

    2023-10-19 04:04:36
  • PHP删除数组中空值的方法介绍

    2023-11-24 03:04:19
  • Python 排序最长英文单词链(列表中前一个单词末字母是下一个单词的首字母)

    2023-08-26 16:08:33
  • python http通信接口开发示例

    2022-06-07 05:15:29
  • 静态页面实现文章点击数统计的js方法

    2008-01-23 19:17:00
  • XXencode 编码,XX编码介绍、XXencode编码转换原理与算法

    2023-11-06 19:14:48
  • Python在Windows和在Linux下调用动态链接库的教程

    2022-01-10 04:55:51
  • Python函数关键字参数及用法详解

    2023-08-13 00:34:06
  • 开启SQLSERVER数据库缓存依赖优化网站性能

    2024-01-26 18:05:20
  • python中__call__方法示例分析

    2023-01-16 04:31:31
  • Python练习之操作MySQL数据库

    2024-01-20 12:29:22
  • Go实现双向链表的示例代码

    2024-03-13 04:11:45
  • JavaScript之IE的fireEvent方法详细解析

    2024-06-05 09:11:28
  • 聊聊QT添加MySQL驱动依赖的问题

    2024-01-14 10:25:58
  • 微信小程序实现上传视频功能

    2023-08-24 16:18:42
  • PHP+Ajax简单get验证操作示例

    2024-05-13 09:24:27
  • tensorflow使用指定gpu的方法

    2022-10-23 16:00:31
  • Django ORM 查询表中某列字段值的方法

    2022-05-08 06:42:20
  • MySQL中如何定义外键

    2010-03-09 16:18:00
  • asp之家 网络编程 m.aspxhome.com