当我们用frameset来开发后台的时候,常常会出现 框架之间有空白的问题。代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>后台管理系统</title>
<style>
body{margin:0;padding:0}
frameset{padding:0px;margin:0px;border:none;}
frame{width:100%;padding:0px;margin:0px;border:none;}
</style>
</head>
<frameset cols="15%,85%" >
<frame src="/admin_left" noresize="noresize" frameborder="0" border="0" marginwidth="0" marginheight="0" allowtransparency="yes" scrolling="auto"/>
<frame name="mainFrame" noresize="noresize" frameborder="0" border="0" marginwidth="0" marginheight="0" allowtransparency="yes" src="/admin_right" />
</frameset>
</html>
这样会导致中间有一个空白,要解决这个问题,只要在frameset里面加一个
frameborder="0"
就可以了。修改后代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>后台管理系统</title>
<style>
body{margin:0;padding:0}
frameset{padding:0px;margin:0px;border:none;}
frame{width:100%;padding:0px;margin:0px;border:none;}
</style>
</head>
<frameset cols="15%,85%" frameborder="0">
<frame src="/admin_left" noresize="noresize" frameborder="0" border="0" marginwidth="0" marginheight="0" allowtransparency="yes" scrolling="auto"/>
<frame name="mainFrame" noresize="noresize" frameborder="0" border="0" marginwidth="0" marginheight="0" allowtransparency="yes" src="/admin_right" />
</frameset>
</html>
对了,如果要兼容IE浏览器,可以把
<frameset cols="15%,85%" frameborder="0">
改成
<frameset cols="15%,85%" frameborder="0" border="0" framespacing="0" >