Изогнутые линии с использованием границы
Хорошо, после небольшого расследования и поиска решений я достиг кривых линий. Но они не идеальны, как я хочу.
Желаемый эффект:
![Desired Effect]()
И это текущий эффект:
![Current Effect]()
Мне интересно, есть ли у кого-то лучшее решение для этого или любого решения, которое может достичь желаемого эффекта.
Здесь код:
.left-corner-lines {
width: 252px;
float: left;
min-height: 40px;
position: relative;
}
.left-round-line {
border-radius: 0 0 0 100%;
border: 4px solid #fbbc56;
position: absolute;
top: 0;
right: -4px;
}
.left-round-line.yellow-round {
height: 12px;
width: 17px;
border-color: transparent transparent transparent #fbbc56;
}
.left-round-line.blue-round {
height: 21px;
width: 26px;
border-color: transparent transparent transparent #0090d0;
}
.left-round-line.purple-round {
height: 30px;
width: 35px;
border-color: transparent transparent transparent #915da3;
}
.left-round-line.pink-round {
height: 39px;
width: 44px;
border-color: transparent transparent transparent #cc5299;
}
.left-round-line.green-round {
height: 48px;
width: 53px;
border-color: transparent transparent transparent #bed140;
}
<div class="left-corner-lines">
<div class="left-round-line yellow-round"></div>
<div class="left-round-line blue-round"></div>
<div class="left-round-line purple-round"></div>
<div class="left-round-line pink-round"></div>
<div class="left-round-line green-round"></div>
</div>
Ответы
Ответ 1
Проверьте обновленную скрипту. https://jsfiddle.net/nileshmahaja/84t6w8ca/3/
Я добавил один контейнер во весь html
<div class="container">
<div class="left-corner-lines">
<div class="left-round-line yellow-round"></div>
<div class="left-round-line blue-round"></div>
<div class="left-round-line purple-round"></div>
<div class="left-round-line pink-round"></div>
<div class="left-round-line green-round"></div>
</div>
</div>
также изменил ваш код css
.container{
position:relative;
width: 200px;
height: 200px;
overflow:hidden;
}
.left-corner-lines {
width: 200px;
left: 50%;
height: 200px;
position: relative;
top:-50%
}
.left-round-line {
border-radius:100%;
border: 5px solid #fbbc56;
position: absolute;
left:0;
right:0;
top:0;
bottom:0;
margin:auto;
}
.left-round-line.yellow-round {
height: 20px;
width: 20px;
border-color:#fbbc56;
}
.left-round-line.blue-round {
height: 40px;
width: 40px;
border-color: #0090d0;
}
.left-round-line.purple-round {
height: 60px;
width: 60px;
border-color: #915da3;
}
.left-round-line.pink-round {
height: 80px;
width: 80px;
border-color: #cc5299;
}
.left-round-line.green-round {
height: 100px;
width: 100px;
border-color: #bed140;
}
Ответ 2
вы также можете использовать box-shadow для достижения этого
.left-corner-lines {
width: 100px;
height: 100px;
position: relative;
overflow: hidden;
}
.left-corner-lines:after {
content: '';
width: 30px;
height: 30px;
right: 0;
margin: -15px -15px 0 0;
border-radius: 50%;
position: absolute;
box-shadow: 0px 0px 0px 5px #fbbc56, 0px 0px 0px 10px #fff, 0px 0px 0px 15px #0090d0, 0px 0px 0px 20px #fff, 0px 0px 0px 25px #915da3, 0px 0px 0px 30px #fff, 0px 0px 0px 35px #cc5299;
}
<div class="left-corner-lines"></div>
Ответ 3
Если вы хотите монохроматические строки, вы можете сделать это только с одним элементом пути в SVG.
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="4 5 30 30">
<path d="M5 5 A 25 25 0 0 0 30 30 m0-5 A 20 20 0 0 1 10 5 m5 0 A 15 15 0 0 0 30 20 m0-5 A 10 10 0 0 1 20 5 m5 0 A 5 5 0 0 0 30 10" fill="none" stroke="black" stroke-width="2" />
</svg>