html – 使用边框的曲线

前端之家收集整理的这篇文章主要介绍了html – 使用边框的曲线前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
那么经过一番调查和寻找解决方案,我已经实现了曲线.但他们并不完美,因为我想要他们.

所期望的效果是这样的:

这是目前的效果

我想知道有没有人能为这个或任何可以达到预期效果解决方案提供更好的解决方案.

以下是代码

  1. .left-corner-lines {
  2. width: 252px;
  3. float: left;
  4. min-height: 40px;
  5. position: relative;
  6. }
  7. .left-round-line {
  8. border-radius: 0 0 0 100%;
  9. border: 4px solid #fbbc56;
  10. position: absolute;
  11. top: 0;
  12. right: -4px;
  13. }
  14. .left-round-line.yellow-round {
  15. height: 12px;
  16. width: 17px;
  17. border-color: transparent transparent transparent #fbbc56;
  18. }
  19. .left-round-line.blue-round {
  20. height: 21px;
  21. width: 26px;
  22. border-color: transparent transparent transparent #0090d0;
  23. }
  24. .left-round-line.purple-round {
  25. height: 30px;
  26. width: 35px;
  27. border-color: transparent transparent transparent #915da3;
  28. }
  29. .left-round-line.pink-round {
  30. height: 39px;
  31. width: 44px;
  32. border-color: transparent transparent transparent #cc5299;
  33. }
  34. .left-round-line.green-round {
  35. height: 48px;
  36. width: 53px;
  37. border-color: transparent transparent transparent #bed140;
  38. }
  1. <div class="left-corner-lines">
  2. <div class="left-round-line yellow-round"></div>
  3. <div class="left-round-line blue-round"></div>
  4. <div class="left-round-line purple-round"></div>
  5. <div class="left-round-line pink-round"></div>
  6. <div class="left-round-line green-round"></div>
  7. </div>

这是小提琴:http://jsfiddle.net/84t6w8ca/

所需的效果必须可以重新创建4个方向.

但是我现在只需要一个,因为我可以根据这些重新创建其他的.

我可以为低版本的浏览器做一个图像回退,所以不要担心IE8或更少

有没有人可以实现这个更好的解决方案?

编辑:

我想要一个更圆润的角落效果,而不是那么圆.

我正在想的是溢出:隐藏的方形,并将div放在其中,固定的边框半径和宽度和高度更大.

我也应该警告你,这行是根据内容动态的,围绕内容,直到页面结尾.此外,它有线从顶部和底部.喜欢这个:

编辑2:

之后@ 0_o回答我试图使用盒子阴影,但你可以注意到它有点模糊.

示例:

编辑3:

使用@NileshMahajan后,我已经实现了以下功能

我不知道现在我的眼睛是否疯狂,但这是我最想达到的目标.

解决方法

请检查更新的小提琴. https://jsfiddle.net/nileshmahaja/84t6w8ca/3/

我已经在整个html中添加了一个容器

  1. <div class="container">
  2. <div class="left-corner-lines">
  3. <div class="left-round-line yellow-round"></div>
  4. <div class="left-round-line blue-round"></div>
  5. <div class="left-round-line purple-round"></div>
  6. <div class="left-round-line pink-round"></div>
  7. <div class="left-round-line green-round"></div>
  8. </div>
  9. </div>

修改了你的css代码

  1. .container{
  2. position:relative;
  3. width: 200px;
  4. height: 200px;
  5. overflow:hidden;
  6. }
  7. .left-corner-lines {
  8. width: 200px;
  9. left: 50%;
  10. height: 200px;
  11. position: relative;
  12. top:-50%
  13. }
  14. .left-round-line {
  15. border-radius:100%;
  16. border: 5px solid #fbbc56;
  17. position: absolute;
  18. left:0;
  19. right:0;
  20. top:0;
  21. bottom:0;
  22. margin:auto;
  23. }
  24.  
  25. .left-round-line.yellow-round {
  26. height: 20px;
  27. width: 20px;
  28. border-color:#fbbc56;
  29.  
  30. }
  31.  
  32. .left-round-line.blue-round {
  33. height: 40px;
  34. width: 40px;
  35. border-color: #0090d0;
  36. }
  37.  
  38. .left-round-line.purple-round {
  39. height: 60px;
  40. width: 60px;
  41. border-color: #915da3;
  42. }
  43.  
  44. .left-round-line.pink-round {
  45. height: 80px;
  46. width: 80px;
  47. border-color: #cc5299;
  48. }
  49.  
  50. .left-round-line.green-round {
  51. height: 100px;
  52. width: 100px;
  53. border-color: #bed140;
  54. }

猜你在找的HTML相关文章