为什么使用此代码框架不可见?

发布于 2024-09-29 03:38:19 字数 1500 浏览 5 评论 0原文

<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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

霓裳挽歌倾城醉 2024-10-06 03:38:19

当您使用框架集时,您使用它而不是主体。只需删除主 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."

绻影浮沉 2024-10-06 03:38:19

在第一个带有框架的例子中;

<link rel="stylesheet" type="text/css" media="screen" href="blogstyle.css">
  <title>Welcome to my blog</title>

大概应该看起来像;

<head>
<link rel="stylesheet" type="text/css" media="screen" href="blogstyle.css">
<title>Welcome to my blog</title>
</head>

也在左窗格中;

<link rel="stylesheet" type="text/css" media="screen" href="blogstyle.css">
<html lang="en">
<head>

我相信最好的做法是将样式表放在 head 标签内;

<html lang="en">
<head>
<link rel="stylesheet" type="text/css" media="screen" href="blogstyle.css">

请参阅http://www.w3.org/TR/html401/struct/links。 html 为例。

In the first example with the frames;

<link rel="stylesheet" type="text/css" media="screen" href="blogstyle.css">
  <title>Welcome to my blog</title>

should probably look like;

<head>
<link rel="stylesheet" type="text/css" media="screen" href="blogstyle.css">
<title>Welcome to my blog</title>
</head>

Also in the left pane;

<link rel="stylesheet" type="text/css" media="screen" href="blogstyle.css">
<html lang="en">
<head>

I believe it is best practice to put the style sheet within the head tag;

<html lang="en">
<head>
<link rel="stylesheet" type="text/css" media="screen" href="blogstyle.css">

See http://www.w3.org/TR/html401/struct/links.html for an example.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文