2012-11-27 112 views
0

IE不顯示圓角。它可以工作,如果我拿出:hoverCSS 3 PIE:懸停不起作用

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
<html> 
    <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
     <title>Untitled Document</title> 
     <style type="text/css"> 
      .tooltip { 
       position:absolute; 
       text-decoration: none; 
       display:inline-block; 
      } 
      .tooltip span { 
       margin-left:-999em;    
      } 
      .tooltip:hover span { 
       background-color: black; 
       border-radius: 5px; 
       -moz-border-radius: 5px; 
       -webkit-border-radius: 5px; 
       color: #fff; 
       display: inline-block; 
       position: relative; 
       left: 30px; 
       padding: 10px; 
       top:0px; 
       z-index:1; 
       behavior:url(PIE.htc); 
       margin-left:0; 
      } 
     </style> 
    </head> 
    <body> 
     <label>This is a label 
      <a href="#" class="tooltip"> 
       <img src="img/help.jpg" style="border:1px solid black;width:15px;height:15px;position:absolute;left:5px;top:5px;"/> 
       <span>This is a test</span> 
      </a> 
     </label> 
    </body> 
</html> 

回答

0

嘗試運用行爲元素,而不:hover僞類:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
<html> 
    <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
     <title>Untitled Document</title> 
     <style type="text/css"> 
      .tooltip { 
       position:absolute; 
       text-decoration: none; 
       display:inline-block; 
      } 
      .tooltip span { 
       margin-left:-999em; 
       behavior:url(PIE.htc);   
      } 
      .tooltip:hover span { 
       background-color: black; 
       border-radius: 5px; 
       -moz-border-radius: 5px; 
       -webkit-border-radius: 5px; 
       color: #fff; 
       display: inline-block; 
       position: relative; 
       left: 30px; 
       padding: 10px; 
       top:0px; 
       z-index:1; 
       margin-left:0; 
      } 
     </style> 
    </head> 
    <body> 
     <label>This is a label 
      <a href="#" class="tooltip"> 
       <img src="img/help.jpg" style="border:1px solid black;width:15px;height:15px;position:absolute;left:5px;top:5px;"/> 
       <span>This is a test</span> 
      </a> 
     </label> 
    </body> 
</html> 

你shouldn'd藏匿切緣陰性的元素:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
<html> 
    <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
     <title>Untitled Document</title> 
     <style type="text/css"> 
      .tooltip { 
       position:absolute; 
       text-decoration: none; 
       display:inline-block; 
      } 
      .tooltip span { 
       left: 30px; 
       top:0px; 
       background-color: black; 
       color: #fff; 
       padding: 10px; 
       display: none; 
       border-radius: 5px; 
       -moz-border-radius: 5px; 
       -webkit-border-radius: 5px; 
       behavior:url(PIE.htc);  
       z-index:1; 
       position: relative; 
      } 
      .tooltip:hover span { 
       display: inline-block; 
      } 
     </style> 
    </head> 
    <body> 
     <label>This is a label 
      <a href="#" class="tooltip"> 
       <img src="img/help.jpg" style="border:1px solid black;width:15px;height:15px;position:absolute;left:5px;top:5px;"/> 
       <span>This is a test</span> 
      </a> 
     </label> 
    </body> 
</html> 
0

是的,你可以做到這一點,但你必須放在一個樣式規則的行爲聲明,不包括:懸停選擇。您可以將其餘的樣式保留在:hover塊中。 關注此IE at hover problem

試試把你的行爲:url(PIE.htc); .tooltip {}中的。它爲我工作。

+0

更改代碼格式 – SGG