Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-webkit-border-radius does not crop image properly

Tags:

html

css

I have 5 browsers for rendering html coded pages: IE9, Firefox 4.0 and all the newest versions of Chrome, Safari and Opera. Now in IE9 and Firefox 4.0 an image is being cropped properly in using border-radius: and -moz-border-radius: but fails in Opera, Chrome and Safari using -webkit-border-radius:. With Opera the image is not being cropped at all and with Safari and Chrome the image is somewhat cropped but with the border being cropped out as well.

.nonTyp{
margin: 15px 15px 15px 15px;
border:4px inset #C1C8DD;
border-radius:25px;
-moz-border-radius:25px;
-webkit-border-radius:25px;
width:200px;
height:200px;

}

If you have one of the 3 browsers mentioned that utilize -webkit-border-radius: please view images for example of what I have an issue with: Graphics Page

like image 360
StHelensBull Avatar asked Apr 11 '11 22:04

StHelensBull


People also ask

How do you crop an image accurately?

Select the Picture Tools > Format tab and select Crop. There are different ways to crop your picture: Drag a cropping handle to crop it from the side, top, or bottom. Press Shift to crop the entire photo down to the size you want.

Why can I not crop an image in Photoshop?

In order to use the Crop command located in the Image menu, you need to have an active selection in your image. The Crop command doesn't offer any options, it simply crops your image to the boundaries of your selection.

Does cropping reduce image quality?

Both require careful consideration as they can affect image quality. Resizing changes the dimensions of the image, which usually affects the file size (and, thereby, image quality). Cropping always involves cutting away part of the original image and results in some of the pixels being discarded.

What happens when an image is cropped?

The Crop tool in most image processing programs is used to trim off the outside edges of a digital image. Cropping can be used to make an image smaller (in pixels) and/or to change the aspect ration (length to width) of the image.


2 Answers

What you could do is put all styling that's on the <img> tag now, on the parent <a> instead so as to use it as the container for the image. This, at least to me, makes more sense as well. Don't forget to keep float: left on the image to get rid of phantom bottom margin either.

like image 119
Matijs Avatar answered Nov 15 '22 19:11

Matijs


I think it's because it is in the foreground above the border

try using the same code you have above, but in your html:

<div class="nonTyp" style="background-image:url('image.jpg');"></div>
like image 28
Ninjiangstar Avatar answered Nov 15 '22 18:11

Ninjiangstar