Reputation: 11448
Is it possible to make the corners of a thumbnail rounded using css?
EDIT - The html starting point is:
<img src='test.jpg' width='50' height='50' />
It has no css on it at the start and I be wanting to round the corners a little...
EDIT+NOTE: The moz-border method doesn't really round the corners of the image itself, which is what I was hoping for, instead it rounds the corners of a boarder square around the images. Looks ok...
Upvotes: 1
Views: 3100
Reputation: 6271
To phrase this better, the following two lines will achieve the desired effect in Firefox, Chrome, and IE9.
-moz-border-radius: 5px;
border-radius: 5px;
More information can be found here: http://www.css3.info/preview/rounded-border/
To accomplish this in IE8, you will need to use javascript. This jquery plugin would do the trick: http://jquery.malsup.com/corner/
Upvotes: 1
Reputation: 86882
Yes using the nifty-corners technique. Nifty corners is an old way to produce rounded edges. It will function in all browsers (old and new browsers)
http://www.html.it/articoli/nifty/index.html
Upvotes: 0
Reputation: 13614
This code will round all four corners and it also supports Opera.
img { -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }
Clayton's solution only rounds the top two corners, which may or may not be what you're looking for.
Upvotes: 0
Reputation: 10508
To expand @Clayton's answer:
You can do it natively in any modern browser:
-moz-border-radius: 5px;
border-radius: 5px;
The vendor prefix -moz
will likely disappear soon.
See this jsfiddle to see it in action. Notice, also, that the rounding is applied directly to the <img>
element.
This works in all current versions of all 5 major browsers.
Upvotes: 4
Reputation: 1555
You can use border-radius
. It doesn't work on <img>
elements, but you could apply border-radius
to a <div>
with the image as the background-image.
Upvotes: 0