Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

css url() not recognized in internet explorer 10

I have this line in my CSS:

.ui-icon-zoom-in { content: url(images/16x16/ZoomIn.png); } 

Which I am using with jQuery UI Button widget like this:

$("#zoomin").button({ text: false, icons: { primary: "ui-icom-zoom-in" } });

In Chrome, I can see the image centered within the button. However, in IE10, I do not see the image.

Am I missing something here?

like image 563
Klaus Nji Avatar asked Apr 21 '13 14:04

Klaus Nji


People also ask

Why CSS not working in Internet Explorer?

This problem occurs because the following conditions are true in Internet Explorer: All style tags after the first 31 style tags are not applied. All style rules after the first 4,095 rules are not applied.

Is not working in IE11?

If you can't open Internet Explorer, if it freezes, or if it opens briefly and then closes, the problem might be caused by low memory or damaged system files. Try this: Open Internet Explorer and select Tools > Internet options. Select the Advanced tab, and then select Reset.


2 Answers

The content property is only valid on :before and :after pseudo-elements. You should change it to:

.ui-icon-zoom-in { 
  background: url(images/16x16/ZoomIn.png) no-repeat; 
  width:16px;
  height:16px;
}

Apart from that, IE8+ only supports content property if a valid DOCTYPE is specified.

like image 181
Niels Keurentjes Avatar answered Nov 12 '22 07:11

Niels Keurentjes


The content property is only accepted on :before and :after pseudo-elements in CSS3. You should probably use a jQuery selector to append the image to the object:

$("#zoomin").html("<img src='images/16x16/ZoomIn.png' alt='Zoom In'>");
like image 32
Glitch Desire Avatar answered Nov 12 '22 07:11

Glitch Desire