html - 具有自定义破折号长度和间距的边框

标签 html css

<分区>

我怎样才能得到这种边框?这个 20px 破折号和 20px 破折号之间的间距。没有自定义背景文件甚至可能吗?我能得到的最接近的是这样的:

   .element {
      width: 600px;
      height: 300px;
      border-radius: 45px;
      background-image: linear-gradient(to right, red 50%, white 50%);
      background-position: top;
      background-size: 10px 1px;
      background-repeat: repeat-x;
    }
 
    
    <div class="element">
    TEXT TEXT
    </div>

直播:https://jsfiddle.net/roo5rbb3/

enter image description here

最佳答案

试试这个:

border-style: dashed;

所以你完整的 CSS 应该是这样的:

.element {
    width: 600px;
    height: 300px;
    border-radius: 45px;
    background-image: linear-gradient(to right, red 50%, white 50%);
    background-position: top;
    background-size: 10px 1px;
    background-repeat: repeat-x;
    border-color: red;
    border-width: 2px;
    border-style: dashed;
}

关于html - 具有自定义破折号长度和间距的边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49555371/

相关文章:

javascript - 将列表项与 $scope 变量进行比较

javascript - 有没有一种 CSS 方法可以解决悬停在触摸设备上的问题?

html - CSS float 属性 - float div 与 float 段落时的行为差异

html - 使用 float 更改两个 DIV 的顺序 - IE 错误

javascript - 通过纯 CSS 在超时后渲染一个组件

css - Internet Explorer 水平结尾导航位置不正确

jquery - AJAX JQuery 请求不起作用

html - 响应式 iframe,下面有固定的 div

html - 如何让div标签在页面中间居中

c# - 在 MVC4 分部 View 中使用 PagedList 时的不良行为