CSS 左右css轮廓

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29404093/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 03:08:36  来源:igfitidea点击:

css outline left and right

css

提问by FeelRightz

Anyway to set css outlineonly show left and right ? Because I can't use border, I tried but it will make more bad outlook .

无论如何设置cssoutline只显示左右?因为我不能使用边框,我尝试过,但它会使前景更加糟糕。

.test{
  margin:10px;
  padding:10px;
  width:100px;
  height:10px;
  outline:10px solid #000;
  }
<div class="test"></div>

回答by jbutler483

You could possibly achieve this using two box shadows:

您可以使用两个框阴影来实现这一点:

div {
  margin: 10px;
  padding: 10px;
  width: 100px;
  height: 10px;
  box-shadow: -5px 0px 0px 0px black, 5px 0px 0px 0px black;
}
<div></div>

回答by DeAR- DAViL

.test{
  margin:10px;
  padding:10px;
  width:100px;
  height:10px;
  outline:10px solid #000;
  }
<div class="test"></div>

there is no such property for outline you can use border

大纲没有这样的属性,您可以使用边框