2010-07-28 79 views

回答

1

的CSS的解決方案試試這個

<img src="yourimg.jpg" style="border:1px #000 solid;-moz-border-radius:5px;border-radius:5px;-webkit-border-radius:5px;"/>

注: 邊界半徑是CSS3標籤,所以它不會在舊的瀏覽器中工作

+0

這可以在現今大多數CSS3投訴瀏覽器中使用。 – Starx 2010-07-28 10:21:32

0

我使用的是純HTML + CSS解決方案,保證交叉瀏覽器。覆蓋。

獲取一張帶有邊框的圖片。與您想要顯示圖片透明的區域。然後將其放在正常圖像的頂部。像這樣:

.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> 

但是你可以用<div>來做到這一點,如果你喜歡。

0

jQuery插件lc_roundz會動態地完成這項工作 - 即使您希望角落是透明的(例如,用於複雜背景,...)。

$("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 
});