2012-07-25 2 views
1

탐색 표시 줄에 CSS 스프라이트를 사용하려고합니다. 많은 인터넷 조사가 끝나면 나는 '가장 단순한'방법을 결정했다고 생각합니다. 브라우저의 뒤로 버튼을 클릭 할 때를 제외하고 모두 제대로 작동하는 것으로 보입니다. IE (8.0.6001.18701)에서는 활성 상태가 '멈춤'(버튼이 눌러 진 것처럼 보입니다)입니다. Firefox (14.0.1)에서 Hover 상태는 '멈춤'입니다. 나는 IE 문제가 아니라 뒤로 버튼에서 마우스를 움직이 자마자 Firefox 문제를 해결할 수 있습니다. 나는 현재 Includes를 사용하여 간단하고 일관성있게 유지하기 위해 헤더 파일에 navbar를 가지고있다. 다음은 템플릿 html입니다. 내 모든 페이지에 이것을 사용합니다.css 스프라이트 활성 상태가 계속 브라우저에 표시됨 뒤로 버튼

<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; 
} 
다음
<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으로이다 (나는이 문제 과거를 얻을 때, 나는 실제로 사용 시체의 나머지 부분에 입력됩니다)

스프라이트 : (새로운 사용자가 이미지를 게시 할 수 없도록 함, 미안)

+0

가 잘못된 세미콜론을 유의하시기 바랍니다 ";" 배경 위치 중 일부가 콜론 ":"으로 수정되었지만 문제를 해결하지 못했습니다. – user1549510

답변

0

:link 및를 사용하십시오. 이전에이 lvha principle 사용하여 개별 :hover:active 상태를 정의하는 모든 공통 기본 상태를 설정하는 10 개 의사 클래스 :

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; } 
+1

문제가 해결되었습니다. 고맙습니다! – user1549510

관련 문제