【问题标题】:CSS3 Outline dashed border on one side onlyCSS3轮廓虚线边框仅在一侧
【发布时间】:2019-09-02 18:36:42
【问题描述】:

我想使用轮廓添加右虚线边框。我知道我不能只在这个属性的一侧做到这一点。

这就是我想要实现的目标:

我尝试使用阴影框,但如果边框是虚线,它就不起作用。

谢谢

width: 125px;
height: 160px;
background-color: #edb103;
outline: 2px dashed #0b0000;
}

【问题讨论】:

  • 你为什么不用border-right?

标签: css outline


【解决方案1】:

如果你不能使用border-right,在::after伪元素周围放置轮廓可能是一个解决方案......

div {
  width: 125px;
  height: 160px;
  background-color: #edb103;
}

div::after {
  display: inline-block;
  width: 0;
  height: 158px;
  content: '';
  position:relative; left:125px; top:1px;
  outline: 1px dashed #0b0000;
}
<div></div>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-09-22
    • 1970-01-01
    • 2014-06-30
    • 2012-02-25
    • 1970-01-01
    • 2016-07-28
    • 2014-04-20
    • 1970-01-01
    相关资源
    最近更新 更多