Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image is being cut off on resizing in Firefox

I'm currently working on a website. I noticed some elements are beeing cut off, if viewed in Firefox. I attached an Image, showing the problem.

The image below is a jsfiddle Screenshot from Firefox.

cut off image

The code reproducing it is located here: JSFIDDLE

It's just an image, with an percantage value set with CSS.

.image-percent {
    width: 30%;
}

The weird thing is, sometimes I am able to reproduce the bug and sometimes it simply vanishes after adding random HTML-Elements or other CSS-Properties.

Anyone already experiences this behaviour or know a workaround, forcing Firefox to resize the image the right way?

like image 525
Kilian Stinson Avatar asked Jun 20 '13 08:06

Kilian Stinson


People also ask

How do I resize an image in Firefox?

To resize an image hold down RMB(configurable) and drag to the bottom-right to increase(and vice versa) the image. Hold down RMB on an image, and use the mouse wheel to zoom/zoomout of an image.

How do you make a picture fit the page?

Open your file, Select Tools > Adjust Size. Set your width first. For this example, I set the width at 504 pixels, but you'll notice that makes the height 336 pixels. And that's how you crop and resize to a required dimension.

How do I resize an image to fit the screen in HTML?

If your image doesn't fit the layout, you can resize it in the HTML. One of the simplest ways to resize an image in the HTML is using the height and width attributes on the img tag. These values specify the height and width of the image element. The values are set in px i.e. CSS pixels.


1 Answers

Actually found the solution in this thread Firefox blurs an image when scaled through external CSS or inline style.

Firefox implemented non-standart css property image-rendering https://developer.mozilla.org/en-US/docs/Web/CSS/image-rendering

Playing with different values this solution gives more or less appropriate result:

image-rendering:optimizeQuality;

http://jsfiddle.net/jGKkB/

like image 59
claustrofob Avatar answered Nov 04 '22 06:11

claustrofob