【问题标题】:dreamweaver html pageDreamweaver html 页面
【发布时间】:2009-11-16 07:38:13
【问题描述】:

我使用dreamweaver 创建了一个HTML 布局。我使用 DIV 标签来设置标题和主体的背景。问题是当我预览页面时,没有显示图像。

有什么帮助吗?

谢谢

现在它出现在 Dreamweaver 预览中,但是当我尝试在 Ruby in Steel(Visual Studio IDE 的 Ruby on Rails)中导入时,它只显示页脚。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
    font: 100% Verdana, Arial, Helvetica, sans-serif;
    background: #666666;
    margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
    padding: 0;
    text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
    color: #000000;
    background-image: url();
}
.oneColFixCtrHdr #container {
    width: 780px;  /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */
    background: #FFFFFF;
    margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
    border: 1px solid #000000;
    text-align: left; /* this overrides the text-align: center on the body element. */
}
.oneColFixCtrHdr #header {
    background: #DDDDDD; 
    padding: 0 10px 0 20px;  /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
}
.oneColFixCtrHdr #header h1 {
    margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
    padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
}
.oneColFixCtrHdr #mainContent {
    padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
    background: #FFFFFF;
}
.oneColFixCtrHdr #footer {
    padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
    background:#DDDDDD;
}
.oneColFixCtrHdr #footer p {
    margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
    padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
}
.logo {
    background-image: url(My%20Pictures/logo.JPG);
}
.main_body {
    background-image: url(My%20Pictures/main_body.JPG);
}
.logo {
    background-image: url(My%20Pictures/logo_menu.JPG);
}
-->
</style></head>

<body class="oneColFixCtrHdr">

<div id="container">
  <div id="mainContent">
    <div>
      <div class="logo">
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
      </div>
    </div>
    <div class="main_body">
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <!-- end #mainContent -->
  </div></div>
  <div id="footer">
    <p>(c) Lily 2009</p>
  <!-- end #footer --></div>
<!-- end #container --></div>
</body>
</html>

【问题讨论】:

  • 请提供更多信息?代码什么的。谢谢;-)
  • 第二。如果没有看到您页面的代码,这可能是数百个问题之一,如果您需要帮助,您必须缩小范围。确保在发布代码时格式化代码。

标签: html image dreamweaver


【解决方案1】:

编辑:

background-image: url(My%20Pictures/logo.JPG);

这可能不适用于正斜杠/,因为您可能在 Windows 上,如果您在网络浏览器中本地查看文件。这还假定您的 HTML 文件位于“我的图片”上方的文件夹中。要进行故障排除,请尝试将您的图片与 html 文件放在同一文件夹中,并使用url(logo.jpg) 以避免路径混淆。

根据我的经验,Dreamweaver 中的 WYSIWYG 编辑器只会导致更多的挫败感,而且会造成大量代码混乱(例如,您的示例中的所有 &lt;p&gt;s)。买一本关于网页设计的好书,你可能会发现用手把它写出来更容易,至少在开始时是这样。 HTML 非常直观,但不是 Dreamweaver 的做法。

原答案:

&lt;head&gt; 标签的内容不显示;它们只是页面的隐藏信息。

您是否使用以下方式插入图片:

<img src="image.jpg" alt="photo" />

??

不过,您应该学习用于样式和背景图像的 CSS。这可以进入&lt;head&gt;,但如果它位于单独的链接 CSS 文件中,则减去 &lt;style&gt; 标记。

<style type="text/css">
    body { background-image:url('bgimg.png'); }
</style>

顺便说一句,Dreamweaver 只是一个精美的文本编辑器,内置了 [糟糕] 浏览器。

【讨论】:

  • 我认为当提问者提到 header 时,他们指的是页面的顶部,而不是 &lt;head&gt; 元素。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-15
  • 1970-01-01
  • 2012-08-29
  • 1970-01-01
  • 2014-09-26
相关资源
最近更新 更多