如何仅使用一个元素 - div 制作图片?

速率

设计师设计了标志。它将需要在各种条件下使用。为了尽可能方便,请在纯 CSS 中使用单个 HTML 元素对其进行布局。

您不能使用图片(即使通过 data:uri)。

我尝试使用伪元素,但它不起作用。笔记

  • 总宽度:180px
  • 总高度:180px
  • 黄色部分高度:90px
  • 白色部分宽度:90px
  • 圆角半径:9px
  • 颜色:
    • 黑色:#0c0c0c
    • 黄色:#f8e34b
    • 白色:#eeedef
  • 阴影:#c8c8c8,178 度

div {  
  width: 180px;  
  height: 180px;  
}

div:before{
	content:"";
	width: 180px;
	height: 90px;
	background: #f8e34b;
}

div:after {
	content: "";
	width: 90px;
	left: 0;
	height: 90px;
	background: #eeedef;
}

div:after{
	content: "";
	width: 90px;
	height: 90px;
	right: 0;
	background: #0c0c0c;
}
    
        <div></div>  

在此处输入图片说明

陪伴阿菲

多背景可以做到这一点:

.box {
  width:180px;
  height:180px;
  border-radius:9px;
  background:
     linear-gradient(#f8e34b,#f8e34b)   top /100% 50%,
     
     linear-gradient(178deg,#c8c8c8 30%, transparent 70%) 
      0 calc(50% + 4px) /50% 8px,
      
     linear-gradient(#0c0c0c,#0c0c0c) bottom right/50% 50%,
     
     #eeedef;
  background-repeat:no-repeat;
    
}
<div class="box"></div>

与了解不同值相关:在线性渐变上使用具有背景位置的百分比值

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章