RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / 问题 / 1431595
Accepted
Denis
Denis
Asked:2022-07-21 03:05:15 +0000 UTC2022-07-21 03:05:15 +0000 UTC 2022-07-21 03:05:15 +0000 UTC

带渐变的圆角框架

  • 772

这是HTML

<div class="status_wrapp"></div>

这是CSS

.status_stars {
    display: block;
    height: 24px;
    border-radius: 48px;
    -webkit-border-radius: 48px;
    border-image-slice: 1;
    border-width: 2px;
    -webkit-border-width: 2px;
    border-style: solid;
    border-image-source: linear-gradient(to left, #FFED4F, #FFC34F);
    border-image-source: -webkit-linear-gradient(to left, #FFED4F, #FFC34F);
}

原来是这样

在此处输入图像描述

你需要这样

在此处输入图像描述

如何制作带圆角的框架?

根据布局,一般情况下应该是这样的

在此处输入图像描述

html css
  • 3 3 个回答
  • 46 Views

3 个回答

  • Voted
  1. Александр Сычёв
    2022-07-21T03:35:12Z2022-07-21T03:35:12Z

    据我所知,border-image不能与border-radius同一类中的属性一起使用。

    您可以通过以下方式解决此问题before

    body {
      padding: 20px;
    }
    
    .circle {
      width: 200px;
      height: 75px;
      background: #673ab7;
      border-radius: 50px;
      position: relative;
      text-align: center;
      color: #fff;
      padding: 20px;
      box-sizing: border-box;
    }
    
    .circle::before {
      border-radius: 55px;
      position: absolute;
      content: '';
      background-image: linear-gradient(to bottom, #FFED4F 0%, #FFC34F 100%);
      top: -5px;
      left: -5px;
      bottom: -5px;
      right: -5px;
      z-index: -1;
    }
    
    .circle::after {
      border-radius: 60px;
      position: absolute;
      content: '';
      background-image: linear-gradient(to bottom, #673ab7 0%, #673ab7 100%);
      top: -20px;
      left: -20px;
      bottom: -20px;
      right: -20px;
      z-index: -2;
    }
    
    .wrapp {
      display: flex;
      width: 100%;
      height: 300px;
      padding: 50px 0;
      justify-content: center;
      align-items: center;
    }
    <div class="wrapp">
      <div class="circle">Тест</div>
    </div>

    • 0
  2. Best Answer
    De.Minov
    2022-07-21T07:03:39Z2022-07-21T07:03:39Z

    我会这样做:

    @import url('//fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0');
    
    .violet-bg {background: linear-gradient(15deg, #7785f8, #74a1d3);}
    .gold-bg {background: linear-gradient(15deg, #f5bf59, #f4e556);}
    
    .button-star {
      display: inline-block;
      border-radius: 90px;
      overflow: hidden;
      padding: 5px;
      box-sizing: border-box;
    }
    
    .button-star__border {
      border-radius: 90px;
      padding: 2px;
      box-sizing: border-box;
    }
    
    .button-star__content {
      border-radius: 90px;
      padding: 5px 15px;
      box-sizing: border-box;
      color: #ffc34f;
      text-shadow: 0 0 2px #fff;
    }
    <div class="button-star violet-bg">
      <div class="button-star__border gold-bg">
        <div class="button-star__content violet-bg">
          <span class="material-symbols-outlined">star</span>
          <span class="material-symbols-outlined">star</span>
          <span class="material-symbols-outlined">star</span>
        </div>
      </div>
    </div>

    • 0
  3. Daniil Loban
    2022-07-21T23:09:12Z2022-07-21T23:09:12Z

    这是2 个 div的变体- 由于窗台,每个“笔划”都绘制在前一个下方。代码中有注释。

    图层演示

    .status_wrapper{
      display: inline-flex; 
      position: relative; /* для позиционирования :before */
      border-radius: 25px;
      padding: 2px; /* ширина внешней голубой обводки */
    } 
    
    .status_wrapper:before {
      content: "";
      z-index: -1; 
      position: absolute;
      top: 0px;   
      right: 0px;
      bottom: 0px;
      left: 0px;
      border-radius: inherit;
      background: rgb(2,0,36); /* фон обводки */
      background: linear-gradient(337deg, rgba(2,0,36,1) 0%, rgba(78,78,222,1) 35%, rgba(0,212,255,1) 100%);
    }
    
    .status_stars {
      display: inline-flex;
      align-items: center;
      position: relative;
      padding: 5px 10px;
      box-sizing: border-box; /* включаем границу в размеры */
      color: gold;
      /* фон */
      background: rgb(2,0,36); 
      background: linear-gradient(337deg, rgba(2,0,36,1) 0%, rgba(78,78,222,1) 35%, rgba(0,212,255,1) 100%);
      background-clip: padding-box; /* под границей фон не рисуется */
      border: solid 2px transparent; /* делаем прозрачность для показа золотой обовдки */
      border-radius: 25px;
    }
    .status_stars:before {
      content: "";
      position: absolute;
      /* выступ золотой обводки из под фона */
      top: -2px;    
      right: -2px;  
      bottom: -2px; 
      left: -2px; 
      /* помещаем ее под фоном */  
      z-index: -1;  
      border-radius: inherit;
      background: linear-gradient(to right, yellow, orange); /* обводка */
    }
    <div class ="status_wrapper">
      <div class="status_stars">
        <span>★★★</span>
       </div>
    </div>
    
    <div class ="status_wrapper">
      <div class="status_stars">
        <span>★★&nbsp;</span>
       </div>
    </div>
    
    <div class ="status_wrapper">
      <div class="status_stars">
        <span>★</span>
       </div>
    </div>

    • 0

相关问题

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5