当前位置: 代码迷 >> HTML/CSS >> 诡谲的<DOCTYPE HTML PUBLIC "//W3C//DTD HTML 4.01 Transitional//EN">
  详细解决方案

诡谲的<DOCTYPE HTML PUBLIC "//W3C//DTD HTML 4.01 Transitional//EN">

热度:1212   发布时间:2012-10-08 19:54:56.0
诡异的<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
.ab_1{
    width:298px;
    height:28px;
    border-style: solid solid none solid ;
	border-width: 1px ;
	border-color: #97caf5 ;
}
.ab_01{
	float:left;
	width:198px;
	height:28px;
	background-color:#60F;
	}
.ab_02{
	float:right;
	width:100px;
	height:28px;
	background-color:#F00;
	}

</style>
</head>
	
<body>
	<div class="ab_1">
        <div class="ab_01"></div>
        <div class="ab_02"></div>
</div>

</body>
</html>

FF、谷歌中效果如下图:

IE中 效果如下图:

?

IE中发现右边那个层掉下来了!

解决办法: 把上面代码中的

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

?改成:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
?

?

1 楼 huangyunbin 2011-11-14  
呵呵,我也遇到类似的情况啊
  相关解决方案