简体   繁体   English

边框半径出现在图像下方

[英]border-radius appearing under image

building a gallery and the border radius around my anchors is not cropping my image. 建立画廊,并且锚点周围的边界半径不会裁剪图像。 and I can't see why. 我不明白为什么。

this is the html 这是HTML

<div id="Portfolio_page">


<div id="portfolio_wrapper">

<a class="thumb" href="img/image-2.jpg" data-lightbox="image-1" title="My caption"></a>
<a class="thumb"  href="img/image-2.jpg" data-lightbox="image-1" title="My caption"><img src="img/image-2.jpg" alt="" height="150px" width="150px"></a>
<a class="thumb"  href="img/image-2.jpg" data-lightbox="image-1" title="My caption"><img src="img/image-2.jpg" alt="" height="150px" width="150px"></a>
<a class="thumb"  href="img/image-2.jpg" data-lightbox="image-1" title="My caption"><img src="img/image-2.jpg" alt="" height="150px" width="150px"></a>
<a class="thumb"  href="img/image-2.jpg" data-lightbox="image-1" title="My caption"><img src="img/image-2.jpg" alt="" height="150px" width="150px"></a>
<a class="thumb"  href="img/image-2.jpg" data-lightbox="image-1" title="My caption"><img src="img/image-2.jpg" alt="" height="150px" width="150px"></a>

</div>

</div>

and here's the css 这是CSS

#portfolio_wrapper{

width:100%;
text-align:center;

}



 #portfolio_wrapper a {
 border-style:solid;
 border-radius:50%;
padding:2px;
text-decoration: none;
display:inline-block;
width: 150px;
height: 150px;
margin: 10px;
opacity: 1;
-webkit-transform: scale(1,1);
-webkit-transition-timing-function: ease-out;
-webkit-transition-duration: 250ms;
-moz-transform: scale(1,1);
-moz-transition-timing-function: ease-out;
-moz-transition-duration: 250ms;
 background-image:url('img/image-2.jpg');
 background-color:#cccccc;


}

#portfolio_wrapper a:hover {
opacity: .7;
-webkit-transform: scale(1.05,1.05);
-webkit-transition-timing-function: ease-out;
-webkit-transition-duration: 250ms;
-moz-transform: scale(1.05,1.07);
-moz-transition-timing-function: ease-out;
-moz-transition-duration: 250ms;
position: relative;
z-index: 99;
}

I don't know what else to say but i have to put more details to be able to post this question. 我不知道该说些什么,但我不得不提出更多细节才能发布这个问题。 any help would be much appreciated. 任何帮助将非常感激。

Try to add overflow:hidden to your anchors: 尝试将overflow:hidden添加到锚点:

Fiddle Demo 小提琴演示

Now everything outsite the border-radius (the overflowing image) will be hidden. 现在, border-radius所有内容(溢出的图像)都将被隐藏。

Set

overflow: hidden;

to the anchor css 到锚CSS

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM