首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用CSS在图像上添加3D效果

使用CSS在图像上添加3D效果
EN

Stack Overflow用户
提问于 2018-08-15 02:04:51
回答 1查看 1.1K关注 0票数 3

我正在尝试在纯CSS的帮助下添加3D效果,我想在这里转换此图像:

(它不是真正的图像,但它是使用<fa-icon icon="undo" mask="circle" transform="shrink-9"></fa-icon>) <fa-icon icon="undo" mask="circle" transform="shrink-9"></fa-icon>)呈现的表单FontAwesome

对于此图像:

但是我不能得到确切的效果。我尝试了一些CSS技巧,但我坚持使用以下输出:

我写的SASS是:

代码语言:javascript
复制
.three-d-effect {
    position: relative;

    &:after {
        content: "";
        position: absolute;
        top: 5%;
        left: 10%;
        width: 80%;
        height: 80%;
        border-radius: 100%;
        filter: blur(1px);
        z-index: 2;
        transform: rotateZ(40deg);
        display: block;
        background: radial-gradient(circle at 50% 80%, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0) 74%, white 80%, white 84%, rgba(255, 255, 255, 0) 100%);
    }
}

有没有可能用CSS达到想要的3D效果?

EN

回答 1

Stack Overflow用户

发布于 2018-08-15 04:24:09

这是我的尝试,我还用CSS创建了箭头:

代码语言:javascript
复制
.box {
  width: 100px;
  height: 100px;
  background: 
   url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64' width='30' height='30'  fill='lightpink'>  <path d='M6 22 L5.84 22 C30 32 36 36 54 60 C56 62 57 62 56 58 C48 34 46 28 27.16 11.17 C10 0 0 17.83 6 22.17 Z' /></svg>") 65px 10px/30px 30px no-repeat,
   radial-gradient(circle at center,#ff4290 20%,transparent 50%),
   radial-gradient(circle at top right,#ff97c2 15%,#ff5d9f 50%,#c4326e 65%);
  border-radius: 50%;
  position: relative;
  box-shadow:0 0 1px #c4326e;
  filter: brightness(110%);
}

.box:before {
  content: "";
  position: absolute;
  top: 25px;
  left: 25px;
  right: 25px;
  bottom: 25px;
  border: 6px solid white;
  border-left-color: transparent;
  border-radius: 50%;
}

.box:after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  background: 
   linear-gradient(#fff, #fff) left/6px 100% no-repeat, 
   linear-gradient(#fff, #fff) bottom/100% 6px no-repeat;
  top: 22px;
  left: 29px;
}
代码语言:javascript
复制
<div class="box">

</div>

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51847370

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档