【发布时间】:2012-07-27 08:02:04
【问题描述】:
我正在尝试使用 Dreamweaver CS6 设置带有 CSS 的垂直导航栏,但我对 CSS 非常陌生,并且直到最近才离开 Dreamweaver 版本 3。我在此导航栏中为顶部、中间和底部图像设置了单独的类。我使用this technique 将每个按钮的整个 div 设置为一个链接。
中间按钮在设计视图、实时模式和浏览器预览中显示得很好。但顶部和底部按钮仅显示在设计视图中。悬停和活动状态适用于所有按钮。我检查并仔细检查了所有文件路径,清除了 Dreamweaver 的缓存,并重新启动了 Dreamweaver。
为什么会发生这种情况?我该如何解决?
这里是相关的源代码。我正在使用 12 列 960 grid 系统。
<!-- This is inside a container_12 div with the site's header/navigation, then a clear, then an <h3> -->
<div class="container_12">
<!-- Header with site's logo and navigation goes here -->
<div class="clear"></div>
<h3>Page header</h3>
<div class="grid_9 prefix_2 suffix_1">
<!-- Several paragraphs of copy using <p> tags -->
<div class="homePageVerticalButtonTop">
<div class="verticalNavigationText"><a style="display:block" href="top.html">top link</a></div>
</div>
<div class="homePageVerticalButtonMiddle">
<div class="verticalNavigationText"><a style="display:block" href="middle1.html">middle link 1</a></div>
</div>
<!-- Several more middle links -->
<div class="homePageVerticalButtonBottom">
<div class="verticalNavigationText"><a style="display:block" href="bottom.html">bottom link</a></div>
</div>
</div>
</div> <!-- end container_12 -->
这是相关的 CSS:
.homePageVerticalButtonTop {
/* Why is the background not showing up? */
background: url(../images/homePageTopButton_normal.png) no-repeat left top;
width: 24.125em;
height: 4.125em;
background-size: 100%;
display: block;
}
.homePageVerticalButtonTop:hover {
/* This works fine */
background: url(../images/homePageTopButton_mouseOver.png) no-repeat left top;
width: 24.125em;
height: 4.125em;
background-size: 100%;
}
.homePageVerticalButtonTop:active {
/* So does this */
background: url(../images/homePageTopButton_mouseDown.png) no-repeat left top;
width: 24.125em;
height: 4.125em;
background-size: 100%;
}
.homePageVerticalButtonMiddle {
/* And so does the rest of these even though homePageVerticalButtonMiddle and homePageVerticalButtonTop are analogous cases and both PNGs are there. */
background: url(../images/homePageMiddleButton_normal.png) no-repeat left top;
width: 24.125em;
height: 4.125em;
background-size: 100%;
}
.homePageVerticalButtonMiddle:hover {
background: url(../images/homePageMiddleButton_mouseOver.png) no-repeat left top;
width: 24.125em;
height: 4.125em;
background-size: 100%;
}
.homePageVerticalButtonMiddle:active {
background: url(../images/homePageMiddleButton_mouseOver.png) no-repeat left top;
width: 24.125em;
height: 4.125em;
background-size: 100%;
}
/* Bottom omitted for brevity, but it's analogous to Top and only works on the hover and active states too. */
.verticalNavigationText {
color: #FFFFFF;
font-family: inherit;
font-size: 1.75em;
padding: 0.59375em 0 0.59375em 0.625em;
}
编辑:请保留主题的答案,说明为什么这些图片会丢失。
【问题讨论】:
-
我永远不会相信 Dreamweaver 中的浏览器预览能够真正反映真实网站上的内容。
-
@MikeBrant:Dreamweaver 中的浏览器预览是指实时模式(CS6 中)还是我从 Chrome/Firefox/IE 中查看的预览?
-
我指的是 Dreamweaver 中的实时模式预览。
标签: html css dreamweaver 960.gs