PDA

Zobacz pełną wersję : Znikające tło buttonów w menu pod IE



olekstar
03-07-2006, 14:46
Witam!
Co zrobiłęm nie tak, że pod Internet Explorerem znikają mi na chwilkę po najechaniu tła obrazków po buttonami. Oto mój kod CSS dotyczący wszystkich odnośników w menu:

a.mainmenu:link, a.mainmenu:visited {
font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
color: #ffffff;
}

a.mainmenu:hover {
font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
color: ffff00;

}

a.mainlevel:link, a.mainlevel:visited {
background: url(../images/button.png) 0 0 no-repeat;
color: #ffffff;
font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
font-style: normal;
font-weight: bold;
font-size: 12px;
height: 21px;
line-height: 22px;
padding-left: 4em;
text-align: left;
vertical-align: middle;
display: block;
width: 147px;
margin-left: 0.5em;
margin-top: 0;
}

a.mainlevel:hover a.mainlevel:active {
color: #ffff00;
background: url(../images/button_active.png) 0 0 no-repeat;
}

a:link, a:visited {
font-size : 10px
font-family : Verdana, Arial, Helvetica, sans-serif;
color : #FFFF00;
font-weight : bold;
text-decoration : none;
}

a:hover {
color : #FFFF00;
text-decoration : none;
}

Pozdrawiam
Olek

enjoy777
05-07-2006, 01:10
stosujesz .png IE ma dziwna tendencje do nieczytania tego formatu, nie zawsze i nie wszedzie ale czasem sie z tym spotykam

olekstar
05-07-2006, 09:30
Dzikuję za odpowiedź, zaraz to sprawdzę.

Daevar
20-07-2006, 11:12
Jeśli masz .png z przezroczystością, to problem jest nie w kodzie, lecz w przeglądarce IE. Polecam przekonwertowanie grafik na format .gif.
Jeśli jednak koniecznie chcesz zachować je jako .png, dołącz do strony poniższy skrypt:



/*

Correctly handle PNG transparency in Win IE 5.5 & 6.
http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.

Use in <HEAD> with DEFER keyword wrapped in conditional comments:
<!--[if lt IE 7]>
<script defer type="text/javascript" src="pngfix.js"></script>
<![endif]-->

*/

var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

if ((version >= 5.5) && (document.body.filters))
{
for(var i=0; i<document.images.length; i++)
{
var img = document.images[i]
var imgName = img.src.toUpperCase()
if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
{
var imgID = (img.id) ? "id='" + img.id + "' " : ""
var imgClass = (img.className) ? "class='" + img.className + "' " : ""
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
var imgStyle = "display:inline-block;" + img.style.cssText
if (img.align == "left") imgStyle = "float:left;" + imgStyle
if (img.align == "right") imgStyle = "float:right;" + imgStyle
if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
+ "filter:progid:DXImageTransform.Microsoft.AlphaImag eLoader"
+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
img.outerHTML = strNewHTML
i = i-1
}
}
}

Rybik
20-07-2006, 11:52
jezeli w pliku index.php templaka ladujesz arkusz stylow przez @import to przed tym wpisem umiesc jakikolwiek tag <link> lub <script> oczywiscie z domknieciem i moga byc puste (jest to hack, na odrobine co innego - o czym wyczytal gdzies w odmetach sieci Zwiastun, ale niezbadane sa wyroki IE)