round corners in a image
I want to display my images with rounded corners in a web page. i want to bring the below effect on my image in a page see the image
开发者_如何学PythonFor a CSS solution try this
<img src="yourimg.jpg" style="border:1px #000 solid;-moz-border-radius:5px;border-radius:5px;-webkit-border-radius:5px;"/>
Note: border-radius is a CSS3 tag so it will not work in old browsers
You can use the jQuery Curvy Corners plugin that does its job in cross-browser fashion.
i use a pure html+css solution, guaranteed crossbrowser. An overlay.
Get a picture with your border in it. With the area where you want to show the picture transparent. Then position it on top of a normal image. Like so:
.overlayable { position:relative; display:block; }
.overlayable span { position:absolute; top:0px; left:0px; }
<a href="http://link.com" class="overlayable">
<img src="imageToShow.png" alt="awsome picture" />
<span>
<img src="overlayImageWithRoundedCorners.png" alt="" />
</span>
</a>
But you can do it with a <div>
aswell if you like.
the jQuery plugin lc_roundz will do the job dynamically - even if you want the corners to be transparent (e.g. for use on complex backgrounds, ...).
$("image").lc_roundz({
radius: 20, // corner-radius
newDadSelector: "", // jQuery style selector string to allow attachment anywhere in the DOM. empty string will inject the canvas next to the original
newid: "%oid_after_lc_roundz", // the new ID for the canvas object. %oid will be replaced with the id of the original object
width: -1, // -1 uses the original image's width
height: -1, // -1 uses the original image's width
replace: false, // boolean to decide whether the original should be removed from the DOM
corner_color: [0,0,0,0] // this means TRANSPARENT ... R,G,B,alpha [0-255] each
});
精彩评论