解决 frameset 框架中间的空白

本文介绍了解决使用HTML frameset开发后台管理系统时出现框架间空白的方法。通过调整frameset标签属性,确保不同浏览器下(包括IE)的一致显示效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

当我们用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" >


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值