html - 我的网站在 Firefox 中看起来不太好

标签 html css firefox

我正在开发一个网络应用程序,我的代码在 chrome 和资源管理器中运行良好,但在 Firefox 上却给我带来了麻烦。 我添加了一个截图链接,这样你就可以看到菜单的外观(黑色的 css 框应该在菜单下面): link to see the menu

这是我的样式 CSS:

/-- 菜单 --/

#menu { height:39px; position:relative; float:right; margin-top:33px; background:url(../images/menu/bg.jpg) repeat-x; }
#menu-left { width:8px; height:38px; position:relative; z-index:10; float:left; background:url(../images/menu/menu-sx.jpg); }
##menu-right { width:8px; height:38px; position:relative; z-index:10; float:right; background:url(../images/menu/menu-dx.jpg); }

.menu-item { float:left; position:relative; z-index:100; cursor:pointer; }
#menu-name { float:left; padding-top:10px; padding-right:11px; font-size:10pt; color:#FFF; text-shadow:#001F2E 0px -1px; }

#menu-rollover-left { width:98px; height:38px; position:absolute; top:0; left:0; z-index:0; background:url(../images/menu/rollover-left.jpg); }
#menu-rollover-right { width:86px; height:38px; position:absolute; top:0; right:0; z-index:0; background:url(../images/menu/rollover-right.jpg); }

/*-- Menu labels --*/
.label { height:34px; position:absolute; top:103px; z-index:200; opacity:0; filter:alpha(opacity=0); }
.label-left { width:9px; height:34px; float:left; background:url(../images/menu/label-left.jpg); }
.label-right { width:9px; height:34px; float:left; background:url(../images/menu/label-right.jpg); }
.label-center { height:34px; float:left; background:url(../images/menu/label-center.jpg) center; }
.label-center span { position:relative; top:7px; font-size:8pt; color:#FFF; text-shadow:#000 0px -1px; }

/*-- Notifications flag --*/
#header a { text-decoration:none;}
#red-flag { width:27px; height:51px; position:absolute; top:33px; right:62px; z-index:300; background:url(../images/menu/red-flag.png); font-size:9pt; color:#FFF; text-shadow:#3B0001 0px -1px; text-align:center; line-height:67px; cursor:pointer; }

这是我的 html 代码:

<div id="menu">
     <div id="menu-left"></div>

        <a href="/doweets/index"><div id="home-btn" class="menu-item" onmouseover="RollMenu(this, event);" onmouseout="RollMenu(this, event);"><img src="/images/menu/home.jpg" /></div></a>
        <a href="/calendar/week"><div id="calendar-btn" class="menu-item" onmouseover="RollMenu(this, event);" onmouseout="RollMenu(this, event);"><img src="/images/menu/calendar.jpg" /></div></a>
        <a href="/findfriends"><div id="addfriends-btn" class="menu-item" onmouseover="RollMenu(this, event);" onmouseout="RollMenu(this, event);"><img src="/images/menu/addfriends.jpg" /></div></a>
        <div class="menu-item"><img src="/images/menu/line.jpg" /></div>

        <div id="menu-name"><%= current_user.name %></div>

        <a href="/notifications/index"><div id="notifications-btn" class="menu-item" onmouseover="RollMenu(this, event);" onmouseout="RollMenu(this, event);"><img src="/images/menu/notifications.jpg" /></div></a>
        <a href="/users/edit"><div id="settings-btn" class="menu-item" onmouseover="RollMenu(this, event);" onmouseout="RollMenu(this, event);"><img src="/images/menu/settings.jpg" /></div>
        <a href="/users/sign_out"><div id="logout-btn" class="menu-item" onmouseover="RollMenu(this, event);" onmouseout="RollMenu(this, event);"><img src="/images/menu/logout.jpg" /></div></a>

        <div id="menu-right"></div>

        <!-- Rollover states -->
        <div id="menu-rollover-left"></div>
        <div id="menu-rollover-right"></div>
</div>



   <!-- Notifications flag -->
   <a href="/notifications/index"><div id="red-flag" onmouseover="RollMenu(this, event);" onmouseout="RollMenu(this, event);">
<%= count %>

<% if count == 0 %>
<script>$("#red-flag").css("display", "none");</script>
<% end %>

</div></a>

在菜单的某些页面上它根本不起作用。 谢谢你们。 尼尔。

最佳答案

尝试这样的事情:

HTML

<ul>
    <li><a href='#' alt='Back to the homepage'><img src='' alt='Home'><span>Home</span></a></li>
    <li><a href='' alt=''><img src='' alt=''/><span>Lorem</span></a></li>
</ul>

CSS

#menu { display:block; padding:0 0 0 5px; background:#ccc; }
#menu li { display:inline-block; padding:0 5px 0 0; height:20px; }
#menu li a { position:relative; }
#menu li a span { position:absolute; top:20px; }
#menu li a:link span,
#menu li a:visited span { display:none; }
#menu li a:hover span,
#menu li a:active span { display:block; }

关于html - 我的网站在 Firefox 中看起来不太好,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6830838/

相关文章:

javascript - 如何更改跨度显示样式,同时更改该跨度的 innerHTML

css - 如何缩小背景图片的大小?

jquery - 用 CSS 拼贴文字

javascript - vimperator,如何根据操作系统设置不同的qmark?

javascript - Google map 用例在 Firefox 中存在 JS 错误

javascript - firefox CSS 转换错误

HTML:菜单作为 UL 而不是 DIV?

javascript - 如果 ajax 完成,则将 html 替换为请求的数据

javascript - 如何让输入类型文件在打开文件选择器之前等待http请求的响应

Html 和 CSS 媒体不适合我