为什么使用此代码框架不可见?
<html>
<link rel="stylesheet" type="text/css" media="screen" href="blogstyle.css">
<title>Welcome to my blog</title>
<body>
<frameset cols="10%,60%,30%" border="0" framespacing="5" frameborder="0">
<frame src="leftpane.htm" name="left_frame" scrolling="no" />
<frame src="middlepane.htm" name="middle_frame" scrolling="no" />
<frame src="rightpane.htm" name="right_frame" scrolling="no" />
</frameset>
</body>
</html>
文件 leftpane.html 包含以下代码:
<link rel="stylesheet" type="text/css" media="screen" href="blogstyle.css">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<meta name="generator" content="Studio 3 http://aptana.com/">
<meta name="author" content="RP">
<!-- Date: 2010-10-22 -->
</head>
<body>
<div id="PhotoBox-Outline" style = "top: 50px; left: 50px">
<div id="PhotoBox" class="shadow" style = "top: 20px; left: 20px">
</div>
</div>
<div id="PhotoBox-Outline" style = "top: 280px; left: 50px">
<div id="PhotoBox" class="shadow" style = "top: 20px; left: 20px">
</div>
</div>
</body>
</html>
当上面的 div 位于第一个代码中并且当我没有定义框架集时,相同的代码正在工作。
<html>
<link rel="stylesheet" type="text/css" media="screen" href="blogstyle.css">
<title>Welcome to my blog</title>
<body>
<frameset cols="10%,60%,30%" border="0" framespacing="5" frameborder="0">
<frame src="leftpane.htm" name="left_frame" scrolling="no" />
<frame src="middlepane.htm" name="middle_frame" scrolling="no" />
<frame src="rightpane.htm" name="right_frame" scrolling="no" />
</frameset>
</body>
</html>
The file leftpane.html contains following code:
<link rel="stylesheet" type="text/css" media="screen" href="blogstyle.css">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<meta name="generator" content="Studio 3 http://aptana.com/">
<meta name="author" content="RP">
<!-- Date: 2010-10-22 -->
</head>
<body>
<div id="PhotoBox-Outline" style = "top: 50px; left: 50px">
<div id="PhotoBox" class="shadow" style = "top: 20px; left: 20px">
</div>
</div>
<div id="PhotoBox-Outline" style = "top: 280px; left: 50px">
<div id="PhotoBox" class="shadow" style = "top: 20px; left: 20px">
</div>
</div>
</body>
</html>
The same code was working when the above div s were in the first code and when I had not defined frameset.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您使用框架集时,您使用它而不是主体。只需删除主 html 文件中的 body 和 /body 标签即可。
http://www.w3.org/TR/html4/present/frames.html
“标准文档有一个 HEAD 部分和一个 BODY。框架集文档有一个 HEAD 和一个代替 BODY 的 FRAMESET。”
When you use frameset you use it instead of body. Just remove your body and /body tags in the main html file.
http://www.w3.org/TR/html4/present/frames.html
"A standard document has one HEAD section and one BODY. A frameset document has a HEAD, and a FRAMESET in place of the BODY."
在第一个带有框架的例子中;
大概应该看起来像;
也在左窗格中;
我相信最好的做法是将样式表放在 head 标签内;
请参阅http://www.w3.org/TR/html401/struct/links。 html 为例。
In the first example with the frames;
should probably look like;
Also in the left pane;
I believe it is best practice to put the style sheet within the head tag;
See http://www.w3.org/TR/html401/struct/links.html for an example.