html – z-index的一半形状

html – z-index的一半形状,第1张

概述我想塑造如下: 我到目前为止尝试了但是如何将它们混合在一起: .clal-loader{ display:flex;}.clal-loader div{ border: 10px solid #38477e; border-left: 0; border-bottom-right-radius: 100px; border-top-right-radius: 100px; 我想塑造如下:

我到目前为止尝试了但是如何将它们混合在一起:

.clal-loader{  display:flex;}.clal-loader div{  border: 10px solID #38477e;  border-left: 0;  border-bottom-right-radius: 100px;  border-top-right-radius: 100px;  wIDth: 30px;  height: 30px;}.clal-loader div:nth-child(1){   border-color:#0cabec;}.clal-loader div:nth-child(2){ transform: rotate(-180deg);     position: absolute;    left: 25px;    z-index: -1;}
<div >  <div></div>  <div></div></div>
解决方法 我会考虑径向渐变,只考虑下面的一个元素.基本上它们是4个相似的渐变,每个渐变创建一个四分之一圆,然后调整顺序以获得最终形状

.Box {  wIDth:100px;  height:150px;  background:    radial-gradIEnt(circle at bottom left,transparent 40%,blue  40%,blue  60%,transparent 61%) top,radial-gradIEnt(circle at bottom right,green 40%,green 60%,radial-gradIEnt(circle at top right,transparent 61%) bottom,radial-gradIEnt(circle at top left,transparent 61%) bottom;      background-size:100% 50%;  background-repeat:no-repeat;  }
<div ></div>

使用两个元素,你可以考虑每个div的伪元素创建与第一个代码相同的思考,然后你所要做的就是调整z-index.

.Box {  wIDth:100px;  height:100px;  position:relative;}.Box > div {  position:absolute;  top:0;  left:0;  right:0;  bottom:0;}.Box > div:before,.Box > div:after {  content:"";  position:absolute;  wIDth:70%;  height:50%;}.Box > div:first-child {  color:red;}.Box > div:last-child {  color:blue;}.Box > div:first-child::before {  z-index:1;  top:0;  left:0;  border-top:15px solID;  border-right:15px solID;  border-top-right-radius:100%;}.Box > div:first-child::after {  bottom:0;  left:0;  border-bottom:15px solID;  border-right:15px solID;  border-bottom-right-radius:100%;}.Box > div:last-child::before {  top:0;  right:0;  border-top:15px solID;  border-left:15px solID;  border-top-left-radius:100%;}.Box > div:last-child::after {  bottom:0;  right:0;  border-bottom:15px solID;  border-left:15px solID;  border-bottom-left-radius:100%;}*,*::before,*::after {  Box-sizing:border-Box;}
<div >  <div></div>  <div></div></div>
总结

以上是内存溢出为你收集整理的html – z-index的一半形状全部内容,希望文章能够帮你解决html – z-index的一半形状所遇到的程序开发问题。

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

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1071314.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-26
下一篇2022-05-26

发表评论

登录后才能评论

评论列表(0条)

    保存