HTML   发布时间:2022-04-15  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了html – css透明形状覆盖图像大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
This is what i am trying to achive

我有 :

#image1 {
    position: absolute;
    bottom: 0px;
    align-self: auto;
    BACkground-color: #dc022e;
    width: 340px;
    height: 100px;
    border-radius: 50% / 100%;
    border-bottom-left-radius: 0;
    /*transform: rotate(10deg);*/
    border-bottom-right-radius: 0;
    opacity: 0.8;
    }
    
    #image2 img {
    width: 80%;
    }
<div>
  <div id="image2">
    <img src="http://t1.gstatic.com/images?q=tbn:ANd9GcThtVuIQ7CBYssbdwtzZjVLI_uw09SeLmyrxaRQEngnQAked5ZB">
  </div>
  <div id="image1"></div>
</div>

最后我不知道如何使其旋转并且边缘切割如图所示

解决方法

一个简单的例子是使用伪元素并在背景中设置图像.
div {
  position: relative;
  height: 300px;
  width: 500px;
  BACkground: url(http://lorempixel.com/500/300);/*image path*/
  overflow: hidden;/*hides the rest of the circle*/
}

div:before {
  content: "";
  position: absolute; /*positions with reference to div*/
  top: 100%;
  left: 50%;
  width: 0;/*define value if you didn't want hover*/
  height: 0;
  border-radius: 50%;
  BACkground: tomato;/*could be rgba value (you can remove opacity then)*/
  opacity: 0.5;
  transform: translate(-50%,-50%);/*ensures it is in center of image*/
  transition: all 0.4s;
}


/*Demo Only*/
div:hover:before {/*place this in your pseudo declaration to remove the hover*/
  height: 100%;
  width: 150%;/*this makes the shape wider than square*/
  transform: translate(-50%,-50%) rotate(5deg);/*ensures it is in center of image + rotates*/
}
div {/*This stuff is for the text*/
  font-size: 40px;
  line-height: 300px;
  text-align: center;
}
<div>HOVER ME</div>

大佬总结

以上是大佬教程为你收集整理的html – css透明形状覆盖图像全部内容,希望文章能够帮你解决html – css透明形状覆盖图像所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。