gpt4 book ai didi

css sprite 事件状态仍然显示在浏览器后退按钮上

转载 作者:太空宇宙 更新时间:2023-11-03 19:02:11 26 4
gpt4 key购买 nike

我正在尝试将 CSS Sprite 用于导航栏。经过大量的互联网研究,我想我已经确定了“最简单”的方法。除了当我单击浏览器的后退按钮时,一切似乎都工作正常。在 IE (8.0.6001.18701) 中,事件状态为“卡住”(看起来按钮被按下)。在 Firefox (14.0.1) 中,悬停状态为“卡住”。我可以忍受 Firefox 问题,因为一旦鼠标从后退按钮上移开它就会消失,但 IE 问题不会。我目前在头文件中有导航栏,我将其与 Includes 一起使用以保持简单和一致。这是模板html。我将其用于所有页面。 (当我解决这个问题时,我会真正进入其余的 body )

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel="stylesheet" type="text/css" href="DS.css">
</head>
<body>
<div id="centerpage">
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table1">
<tr>
<td>
<!--webbot bot="Include" U-Include="Nav_Includes/Header.htm" TAG="BODY" --></td>
</tr>
<tr>
<td>Enter page data here.<br>
<hr width="770" size="1">
<span id="timestamp">Page last updated:
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%m/%d/%Y %I:%M %p" --></span></td>
</tr>
<tr>
<td>
<!--webbot bot="Include" U-Include="Nav_Includes/Footer.htm" TAG="BODY" --></td>
</tr>
</table>
</div>
</body>
</html>

这是 header.htm:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Dolphin Storage Header</title>
<link rel="stylesheet" type="text/css" href="../DS.css">
</head>
<body>
<img border="0" src="../images/header.jpg" width="760" height="101" align="center">
<p><a class="navHome" href="../index.htm"></a>
<a class="navUnits" href="../units.htm"></a>
<a class="navSpecials" href="../specials.htm"></a>
<a class="navAbout" href="../about.htm"></a>
<a class="navContact" href="../contact.htm"></a></p>
</body>
</html>

CSS文件:

body {
font-family: Arial, Helvetica, Sans-serif;
color: #000000;
text-align:center; /* Fix for IE not centering webpage */
background-color: #ffe670;
}
#centerpage {
width: 770px;
margin: 0 auto; /* Top & Bottom = 0, Right & Left = auto to center the page horizontally */
text-align:left; /* 2nd part of IE fix for centering webpage */
}
/* Navagation bar, using 'sprite' images */
a.navHome {
display: block;
float: left;
width: 160px;
height: 30px;
background-image: url('Nav_Buttons/Home.jpg');
background-repeat: no-repeat;
background-position; 0 0;
}
a.navHome:hover {
background-position: 0 -30px;
}
a.navHome:active {
background-position: 0 -60px;
}

a.navUnits {
display: block;
float: left;
width: 150px;
height: 30px;
background-image: url('Nav_Buttons/Units.jpg');
background-repeat: no-repeat;
background-position; 0 0;
}
a.navUnits:hover {
background-position: 0 -30px;
}
a.navUnits:active {
background-position: 0 -60px;
}

a.navSpecials {
display: block;
float: left;
width: 150px;
height: 30px;
background-image: url('Nav_Buttons/Specials.jpg');
background-repeat: no-repeat;
background-position; 0 0;
}
a.navSpecials:hover {
background-position: 0 -30px;
}
a.navSpecials:active {
background-position: 0 -60px;
}

a.navAbout {
display: block;
float: left;
width: 150px;
height: 30px;
background-image: url('Nav_Buttons/About.jpg');
background-repeat: no-repeat;
background-position; 0 0;
}
a.navAbout:hover {
background-position: 0 -30px;
}
a.navAbout:active {
background-position: 0 -60px;
}

a.navContact {
display: block;
float: left;
width: 160px;
height: 30px;
background-image: url('Nav_Buttons/Contact.jpg');
background-repeat: no-repeat;
background-position; 0 0;
}
a.navContact:hover {
background-position: 0 -30px;
}
a.navContact:active {
background-position: 0 -60px;
}

#timestamp {
font-family: Arial, Helvetica, Sans-serif;
color: #000000;
font-size: xx-small;
}

H5 {
font-family: Georgia, "Times New Roman", Times, serif;
color: #035f8e;
}

Sprite :(不会让新用户发布图片,抱歉)

最佳答案

使用 :link:visited 伪类在定义单独的 :hover 之前设置所有常见的默认状态>:active 状态使用 lvha principle :

a.navUnits:link, a.navUnits:visited, a.navSpecials:link, a.navSpecials:visited, a.navAbout:link, a.navAbout:active, a.navContact:link, a.navContact:visited, a.navHome:link, a.navHome:visited { background-position: 0 0; }

关于css sprite 事件状态仍然显示在浏览器后退按钮上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11653986/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com