當我們用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" >