2012-03-05 47 views
0

我正在爲我的學校編程一個網站,並且我想讓背景中的字符具有懸停效果。當您將鼠標懸停在大多數瀏覽器中的這些字符上時,會彈出一個窗口,顯示他們是誰。這適用於Internet Explorer以外的所有瀏覽器。在IE中,鏈接的一小部分是可點擊的,但其餘部分不是。我不確定這是否與z-index類似,因爲它具有很高的z-索引。IE中奇怪的z索引或鏈接問題

這裏是CSS:

* 
{ 
margin:0px; 
padding:0px; 
} 

#grass 
{ 
left: 0px; 
background-repeat: repeat; 
background-image: url(http://thestopitcampaign.com/images/grass.jpg); 
bottom:0px; 
margin:0px; 
position:fixed; 
padding:0px; 
font-size:15px; 
height: 200px; 
width: 100%; 
z-index:-6; 
} 

#env 
{ 
z-index: -5; 
position:fixed; 
height:500px; 
bottom:0px; 
width:100%; 
left:0px; 
} 

.envimg 
{ 
bottom:0px; 
position:fixed; 
float:left; 
display:block; 
margin-left:auto; 
margin-right:auto; 
} 

#people 
{ 
padding: 0px; 
bottom: 0px; 
position: fixed; 
width: 900px; 
right: 50%; 
left: 50%; 
margin-right: -450px; 
margin-left: -450px; 
z-index:-4; 
} 

#school 
{ 
width: 500px; 
right: 50%; 
left: 50%; 
margin-right: -250px; 
margin-left: -250px; 
margin-bottom: 0px; 
z-index:-5; 
} 

body, html 
{ 
font-family: "PT Sans", sans-serif; 
overflow-x:hidden; 
overflow-y:auto; 
-ms-overflow-x:hidden; 
-ms-overflow-y:auto; 
height:100%; 
width:100%; 
z-index:-7; 
} 

#wrapper 
{ 
z-index: 1000; 
position: relative; 
height:100%; 
padding-left:10px; 
padding-right:10px; 
overflow-x:hidden; 
overflow-y:auto; 
-ms-overflow-x:hidden; 
-ms-overflow-y:auto; 
} 

.cloud 
{ 
bottom: 0px; 
left: -600px; 
position:fixed; 
z-index:-6; 
} 

#cloudpic 
{ 
height:200px; 
} 

#sunmoon 
{ 
position:fixed; 
top:100px; 
right:200px; 
z-index:-7; 
height:300px; 
} 

#sunmoonimg 
{ 
height:300px; 
} 

#content 
{ 
top: 40px; 
border-color: black; 
border-style: solid; 
border-width: 2px; 
background-color: #e6e6e6; 
max-width: 1000px; 
margin-right: auto; 
margin-left: auto; 
display: block; 
position: relative; 
z-index: 1; 
padding:30px; 
-moz-border-radius: 15px; 
border-radius: 15px; 
} 

h1 
{ 
font-family: "Mate SC", sans-serif; 
font-weight:normal; 
font-size:7em; 
margin:10px; 
} 

#main 
{ 
text-align: center; 
height:100%; 
display:inline; 
} 

#logo 
{ 
display: inline; 
width: 100px; 
} 

@<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'> 

@.nav ul 
{ 
display: inline; 
list-style-type:none; 
margin-top:10px; 
position:relative; 
} 

.nav li 
{ 
display: inline; 
margin:10px; 
} 

.nav a 
{ 
display: inline; 
text-decoration:none; 
color:black; 
} 

.nav a:hover 
{ 

    color: #ff451b; 

} 

#logodiv 
{ 
top:10px; 
width: 600px; 
margin-right: auto; 
margin-left: auto; 
display: block; 
position: relative; 
z-index: 4; 
text-align:center; 
} 

.nodec 
{ 
text-decoration:none; 
color:black; 
} 

img 
{ 
display:inline; 
} 

#navbar 
{ 
margin-right: auto; 
margin-left: auto; 
position: relative; 
top: 0px; 
display: block; 
z-index: 4; 
text-align:center; 
font-size:30px; 
font-family:"Oswald","American Typewriter","serif"; 
} 

#header 
{ 
margin-bottom: 10px; 
font-size: 10px; 
} 

#logocorner 
{ 
position:absolute; 
bottom:10px; 
left:10px; 
z-index:-3; 
} 

#logopic 
{ 
width:100px; 
} 

.nav a:active 
{ 
    color: #c45c00; 
} 

#™ 
{ 
position:absolute; 
top:0px; 
} 

#body 
{ 
background-color: #7ebcff; 
} 

.name 
{ 
font-weight:bold; 
} 

#name 
{ 
border:1px solid black; 
outline:none; 
width:200px; 
} 

#message 
{ 
height:50px; 
width:200px; 
resize:both; 
border:1px solid black; 
outline:none; 
} 

.name 
{ 
text-align:left; 
width:120px; 
} 

.post 
{ 
text-align:left; 
} 

table.bulletin 
{ 
position:relative; 
display:block; 
margin-left:auto; 
margin-right:auto; 
max-width:500px; 
} 

.post 
{ 
display:block; 
margin:5px; 
} 

td 
{ 
padding:5px; 
} 

#post 
{ 
width:200px; 
position:relative; 
margin-left:auto; 
margin-right:auto; 
display:block; 
text-align:center; 
margin-top:20px; 
} 

#submit 
{ 
display:block; 
position:relative; 
width:202px; 
text-align:center; 
} 

#showbulletin 
{ 
cursor:pointer; 
cursor:hand; 
} 

#showbulletin:hover 
{ 
color: #ff451b; 
} 

#query 
{ 
width:100px; 
border:1px solid black; 
outline:none; 
} 

#newmotd 
{ 
width:100px; 
border:1px solid black; 
outline:none; 
} 

#motd 
{ 
text-align:center; 
margin-bottom: 20px; 
font-size:15px; 
font-style: italic; 
} 

#signup 
{ 
    padding: 10px; 
    background-color: #f98f0c; 
    right:20px; 
    top: 20px; 
    display: block; 
    position: absolute; 
    border-radius: 5px; 
    -moz-border-radius: 5px; 
    z-index: 5; 
} 

input.signup 
{ 
    width:200px; 
} 

input.signupsubmit 
{ 
    width:200px; 
} 

#txtDefaultHtmlArea 
{ 
background-color: white; 
height:300px; 
width: 100%; 
resize:both; 
} 

#signup:active 
{ 
    background-color: #ff6914; 
} 

iframe 
{ 
    background-color: white; 
} 

#suspensionlink 
{ 
    left: 20px; 
    padding: 10px; 
    background-color: #f9de43; 
    top: 20px; 
    display: block; 
    position: absolute; 
    border-radius: 5px; 
    -moz-border-radius: 5px; 
    z-index: 5; 
} 

#suspensionlink:active 
{ 
    background-color: #ffc500; 
} 

.suspform 
{ 
    text-align: center; 
    display: block; 
} 

textarea.suspform 
{ 
    padding: 2px; 
    text-align: left; 
    margin-right: auto; 
    margin-left: auto; 
    display: block; 
    position: relative; 
    height: 100px; 
    width: 300px; 
} 

span.suspform 
{ 
    margin-bottom: 5px; 
    margin-top: 15px; 
    font-weight: bold; 
} 

form.suspform 
{ 
    width: 600px; 
    margin-right: auto; 
    margin-left: auto; 
    display: block; 
    position: relative; 
} 

#submitref 
{ 
    margin-top: 10px; 
} 

input.suspform 
{ 
    padding: 2px; 
    width: 150px; 
    text-align: left; 
    margin-right: auto; 
    margin-left: auto; 
    display: block; 
    position: relative; 
} 

.cover 
{ 
    display: block; 
    margin-right: auto; 
    margin-left: auto; 
    position: relative; 
    width: 400px; 
    border-color: black; 
    border-width: 1px; 
    border-style: solid; 
} 

area 
{ 
border: 1px dashed black; 
} 

下面是錨標記

#container_people 
{ 
z-index: 500; 
padding: 0px; 
bottom: 0px; 
position: fixed; 
height: 284px; 
width: 1390px; 
right: 50%; 
left: 50%; 
margin-right: -688.5px; 
margin-left: -688.5px; 
} 

#popup 
{ 
    text-align: center; 
    padding: 5px; 
    background-color: #e6e6e6; 
    left:0px; 
    bottom: 10px; 
    display: block; 
    position: absolute; 
    border-radius: 5px; 
    -moz-border-radius: 5px; 
    z-index: 5; 
    display:block; 
    width:170px; 
} 

a 
{ 
outline:none; 
} 

這裏有錨標籤

.hoverover 
{ 
    z-index: 5; 
} 

,這裏的DIV是用於在HTML頁碼:

<!DOCTYPE html> 
<html lang="en"> 
    <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
     <link rel="stylesheet" type="text/css" href="http://www.thestopitcampaign.com/stylesheet.css?1330921248" /> 
     <script type="text/javascript" src="http://thestopitcampaign.com/javascript/jquery.js?1330921248"></script> 
     <script type="text/javascript" src="http://thestopitcampaign.com/javascript/curvycorners.js?1330921248"></script> 
     <link href='http://fonts.googleapis.com/css?family=PT+Sans|Mate+SC|Righteous|Oswald' rel='stylesheet' type='text/css'> 
     <meta name="description" content="STOP IT! ANTI-BULLYING CAMPAIGN." /> 
      <meta name="keywords" content="STOP, IT, stop, it, bullying, campaign, school, kids, adults" />  <title> 
     The Stop It Campaign!  </title> 
    </head> 
    <body id="body"> 
     <div id="wrapper"> 

START

佐伊:良好證人,270);」的onmouseout = 「popuphide();」> 盧卡:受害者」,450);」鮑爾斯太太:老師',810);「m::」「」,))))012 012 012 012 012 012 012 012 012「」「」「」「」「」「」「」的onmouseout = 「popuphide();」> 最大:欺負」,1005);」的onmouseout = 「popuphide();」>

END

  <img class="envimg" id="school" src="http://thestopitcampaign.com/images/school.png" alt="school" /> 



     </div> 
     <div id="sunmoon"> 
      <img id="sunmoonimg" src="http://thestopitcampaign.com/images/sun.png" alt="sun" /> 
     </div> 
     <div id="grass"></div> 
     <div class="cloud" id="cloud1"><img src="http://thestopitcampaign.com/images/cloud.png" alt="cloud" id="cloudpic" /></div> 
       <div id="logodiv"> 
      <a href="http://thestopitcampaign.com/index.php" title="home" class="nodec"><h1>STOP IT!</h1></a> 
     </div> 
     <div id="motd"> 
      <p>"STAND UP, SPEAK UP, INFORM and DOCUMENT "</p> 
     </div> 
     <div id="navbar"> 
      <ul class="nav"> 
      <li class="nav"><a href="http://thestopitcampaign.com/about" class="nav">About</a></li> 
      <li class="nav"><a href="http://thestopitcampaign.com/parents" class="nav">Parents</a></li> 
      <li class="nav"><a href="http://thestopitcampaign.com/educators" class="nav">Educators</a></li> 
      <li class="nav"><a href="http://thestopitcampaign.com/bulletin" class="nav">Bulletin</a></li> 
      </ul> 
     </div> 
     <a href="http://thestopitcampaign.com/signup" class="nodec" title="Join S.T.O.P. I.T."><div id="signup" style="text-align:center;"> 
     Join the campaign!<br/>6 members! 
     </div></a> 
     <a href="http://thestopitcampaign.com/reflection" class="nodec"><div id="suspensionlink">Suspension Reflections</div></a> 
     <div id="logocorner"><img src="http://thestopitcampaign.com/images/logo.png" id="logopic" alt="logo" title="The StopIt Campaign" /><span id="™">&trade;</span></div> 

<script type="text/javascript" src="http://www.thestopitcampaign.com/javascript/environment.js?1330921248"></script> 
    </div> 
    </body> 
</html> 

謝謝你對我的幫助,因爲我花了很長時間試圖弄清楚這一點,我相信大家都同意,IE是非常令人沮喪的Web開發人員

點擊此處閱讀站點:http://thestopitcampaign.com

+3

請不要發佈您的所有代碼,請提供[簡化測試用例](http://css-tricks.com/reduced-test-cases/)。最好在[dabblet](http://dabblet.com/)或[Jsfiddle](http://jsfiddle.net/)上。 – bookcasey 2012-03-05 04:25:08

+0

由於書架提到,說這裏是我的網站請修復它不是很有幫助。你能否至少將我們指向控制標籤和它的CSS的html? – mrtsherman 2012-03-05 04:29:04

+0

很少有問題:1.哪個版本的IE(有很大的差別),2.你是否在每個瀏覽器的同一臺計算機上測試(我看到很多定位,所以顯示器的大小可以改變)3.我去了在Chrome瀏覽器中,我的電腦風扇立即啓動,因此如果網站內存密集,可能還有其他更緊迫的問題。哦,和PS:漂亮的網站。 – Anthony 2012-03-05 04:29:23

回答

1

我不確定哪個IE給你適合 - 但我已經遇到奇怪的懸停狀態問題,絕對定位鏈接之前在至少IE7。

即使您給它顯示:block,「可點擊」或「可滾動」區域僅限於鏈接中的文本,但不限於填充或其他任意尺寸。由於您在這些鏈接中沒有任何文字,是的,您將被限制在一個非常小的區域。

我的工作是給鏈接一個背景圖像 - 甚至一個實際上並不存在的圖像。

所以,在IE-只有樣式表,你可以試試:

#container_people a { 
    background: url(trasparent.gif); 
} 

我發現,圖像文件(transparent.gif)並不實際存在。 IE只需要就認爲它存在。黑客,是的,但它的作品。

這已經爲我清除了一些鏈接問題。

+0

謝謝soooo多!經過大量研究,這是什麼工作! – 2012-03-06 01:54:15

0

可能是一個具有跨瀏覽器功能的JavaScript框架,例如jquery(一般)或jquery tools(特殊覆蓋...工具提示)值得一看。

+0

懸停功能有點在jQuery中,我只是使用HTML事件。 – 2012-03-05 05:16:39