Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Odd box in chrome

I'm trying to place an animated gif over a jpg, and it seems to work in most browsers (IE, Firefox, iPhone, iPad), but there is a strange box around the animated gif in chrome on windows, firefox for the mac, and chrome for the mac.

I finally solved it through a few odd hacks, like forcing the image to resize to 99.9%, using a mask to only allow a portion of the animated gif to show through, but is there a better/cleaner cross browser solution?

I basically started with a div and an image inside, both of which are responsive.
HTML:

<div>
    <img src="http://www.enjoyillinois.com/images/animations/Garden_of_Gods_anim_full.gif" />
</div>

CSS:

div {
    background-image: url("http://www.enjoyillinois.com/images/animations/Garden_of_Gods_bg.jpg");
    background-repeat: no-repeat;
    background-size: cover;
}

img {
    width:100%;
    display:block;
}

Here is a jsfiddle: http://jsfiddle.net/GyDCx/7/

like image 398
Robert McKee Avatar asked May 22 '13 05:05

Robert McKee


People also ask

How do I get rid of weird ads on Google Chrome?

Open the Chrome app and, in the upper right corner, tap on the Settings kebab menu. Scroll down to Site settings. Tap Pop-ups and redirects and tap the toggle to block pop-ups. When disabled, the toggle should be grey.

Why does Chrome keep telling me I have a virus?

The Google Chrome pop-up virus is a common and frustrating malware on Android phones. The most common cause for this virus is downloading apps from third-party or unknown sources which contain the malware. The most important thing is to NOT tap anywhere on the pop-up!

Why is there a blue outline on my Chrome browser?

Power to the Developer! Was this reply helpful? Hi Meiko27, that blue border means your device is going into Tablet Mode automatically for some unknown reason . . . That's It!


1 Answers

It's a image edge scaling problem, the solution I use in such cases is:

img{ image-rendering:-webkit-optimize-contrast; }

That disables the blurry edge when scaling images. http://jsfiddle.net/GyDCx/31/

like image 79
Willem Avatar answered Oct 02 '22 01:10

Willem