首页前端开发HTMLcss border不能同时设置圆角和 border-image

css border不能同时设置圆角和 border-image

时间2023-10-21 14:57:03发布访客分类HTML浏览831
导读:如标题,css border不能同时设置圆角和 border-image,当我想要实现既有圆角,并给圆角加 border-image的时候,发现无法同时生效,只有 border-image会生效。<!DOCTYPE html>...

如标题,css border不能同时设置圆角和 border-image,当我想要实现既有圆角,并给圆角加 border-image的时候,发现无法同时生效,只有 border-image会生效。

!DOCTYPE html>
    
html lang="en">
    

head>
    
  meta charset="UTF-8">
    
  meta http-equiv="X-UA-Compatible" content="IE=edge">
    
  meta name="viewport" content="width=device-width, initial-scale=1.0">
    
  title>
    Document/title>
    
  style type="text/css">

    a {
    
      position: relative;
    
      display: inline-block;
    
      font-size: 14px;
    
      color: #a81c2e;
    
      border: 1px solid;
    
      border-radius: 30px;
    
      padding: 15px 40px;

    }


    a:before {
    
      position: absolute;
    
      width: 98%;
    
      height: 100%;
    
      content: '';
    
      display: block;
    
      border: 1px solid;
    
      border-radius: 30px;
    
      border-image: linear-gradient(to right, #9f1a2c, #012069);
    
      -webkit-border-image: linear-gradient(to right, #9f1a2c, #012069);
    
      -o-border-image: linear-gradient(to right, #9f1a2c, #012069);
    
      border-image-slice: 10%;
    
      top: 0;
    
      left: 0;
    
      right: 0;
    
      bottom: 0;

    }
    
  /style>
    
/head>
    

body>
    
  a>
    渐变色/a>
    
/body>
    

/html>
    

参考文章

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: css border不能同时设置圆角和 border-image
本文地址: https://pptw.com/jishu/504577.html
Angular Component 属性绑定 target 和 attr.target 的区别 【益智游戏】开锁小游戏+ChatGPT写html代码

游客 回复需填写必要信息