css - 背景图像圆角

css - 背景图像圆角,第1张

我想在这个背景图像上制作圆角。但它似乎影响了div框。

<div class="watermark">
<div class="watermark-image" style="background-image:url({{blogthreadlist.blogUri}});"></div>
<div class="col-md-12">Something else</div>
<div class="col-md-12">Something more..</div>
<div class="col-md-12">Something at the end</div>

.watermark {
  display: block;
  position: relative;
}

.watermark-image {
  content: "";
  opacity: 0.2;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  position: absolute;
  z-index: -1;   
}

如何围绕图像的圆角而不是div框? div我比图片大..

最佳答案:

3 个答案:

答案 0 :(得分:1)

您可以为图片添加单独的<img>标记,并设置border-radius

<div class="watermark-image"><img class="rounded-img" src="{{blogthreadlist.blogUri}}"></img></div>

CSS

.rounded-img {
  border-radius: 3px;
}

答案 1 :(得分:0)

图片的圆角,试试这个Demo

<div class="watermark-image" style="background-image:url(https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQNbB93-oZdCcp-OwO5m05v07sAJe42lOpOy8dRnT3aZ8uArqZJ);background-repeat: repeat-x;border-radius: 5px;"></div>

答案 2 :(得分:0)

使用此

 .watermark-image {
  content: "";
  opacity: 0.2;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  position: absolute;
  z-index: -1;   
  border-radius:50px;
}
本文经用户投稿或网站收集转载,如有侵权请联系本站。

发表评论

0条回复