css - 如何仅在 CSS 中构建此图标?

标签 css user-interface icons font-awesome css-shapes

我喜欢 build this icon (使用 Fontawesome)仅使用 CSS。什么是 CSS 的最佳实践?谢谢!

enter image description here

最佳答案

到目前为止,这是一个粗略的设计,但向您展示了如何单独使用 css 来实现这一点。

我还通过使用 vw 单位以及 % 单位以这种方式设计了它应该是可扩展的。

.circle {
  height: 20vw;
  width: 20vw;
  background: green;
  border: 10px solid lightgreen;
  border-radius: 50%;
  position: relative;
}
.square {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  height: 40%;
  width: 40%;
  box-sizing: border-box;
  border: 0.5vw solid white;
  border-radius: 5px;
}
.square:before,
.square:after {
  content: "";
  position: absolute;
  background: white;
}
.square:before {
  height: 20%;
  width: 40%;
  top: 50%;
  left: 20%;
  border-radius: 5px 0 5px 5px;
  transform: rotate(45deg);
  z-index: 10;
}
.square:after {
  height: 100%;
  width: 20%;
  top: -8%;
  left: 70%;
  border-radius: 10px 10px 10px 0;
  transform: rotate(45deg);
  border: 5px solid green;
  border-bottom: none;
}
<div class="circle">
  <div class="square"></div>
</div>

关于css - 如何仅在 CSS 中构建此图标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32819632/

相关文章:

html - 如何在另一个div中使用css实现悬停效果?

javascript - 尝试打印页面时如何隐藏导航栏

javascript - 今天的谷歌图片控件是如何工作的

android - 如何创建像谷歌位置历史这样的安卓时间轴 View ?

css - 对齐 Div,表格样式,用于社交媒体图标

javascript - 是否可以将图标填充为百分比?

ios - iOS 应用程序的本地化应用程序图标

javascript - 在我的案例中如何检测 div 冲突?

java - 如何使主 GUI 线程 'wait' 直到一个单独的弹出窗口消失

java - 如何同时为左键和右键单击创建一个事件?