You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

HTML中frameset能否先列后行?双列双行框架布局异常求助

问题原因与解决方案

你的代码问题在于并列使用了两个顶级<frameset>标签——HTML规范中,一个框架页面只能有一个顶级<frameset>,浏览器会自动忽略第一个之后的所有同级<frameset>,所以右侧的上下行区域完全没被渲染。

要实现左侧两列、右侧上下两行的布局,需要用嵌套frameset的方式,把右侧区域替换成一个纵向划分的子frameset:

修正后的代码

<html>
 <head>
  <title>Frames</title>
 </head>
 <!-- 顶级frameset:划分左侧两列(各20%)和右侧区域(剩余60%) -->
 <frameset cols="20%,20%,60%">
   <frame name="leftleft" src="menu1.html">
   <frame name="leftright" src="menu2.html">
   <!-- 右侧嵌套frameset:纵向分成上下两行各50% -->
   <frameset rows="50%,50%">
        <frame name="top" src="cabecera.html">
        <frame name="bottom" src="sample.html">
   </frameset>
 </frameset>
 <!-- 兼容不支持框架的浏览器 -->
 <noframes>
   <body>你的浏览器不支持框架功能,请使用支持框架的浏览器访问。</body>
 </noframes>
</html>

核心说明

  • 所有框架结构必须嵌套在同一个顶级<frameset>内部,不能并列多个顶级frameset
  • 右侧区域用<frameset>替代普通<frame>,通过rows属性实现上下两行的划分
  • 额外添加<noframes>标签,确保不支持框架的浏览器能显示提示内容

内容的提问来源于stack exchange,提问作者Satchmo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.14 17:15:52