css - 如何在此对象的右侧添加边框?

标签 css

如何在此对象的右侧添加边框以完成具有与左侧边框相同属性的正方形。添加框阴影:20px 0 0 0 红色;不起作用,但会覆盖左边框。

https://jsfiddle.net/kheuz1z4/

HTML

CSS

#borders {
  border-top: 20px solid black;
  box-shadow: -20px 0 0 0 red;
  border-bottom: 20px solid green;
  height: 150px;
  margin: 30px;
  width: 150px;
  border-radius: 20px 20px 0px 0px;
}

最佳答案

你可以用逗号分隔 box-shadow:

  #borders {
  border-top: 20px solid black;
  box-shadow: -20px 0 0 0 red, 20px 0 0 0 red;
  border-bottom: 20px solid green;
  height: 150px;
  margin: 30px;
  width: 150px;
  border-radius: 20px 20px 0px 0px;
}

来源:Is there a way to use two CSS3 box shadows on one element?

关于css - 如何在此对象的右侧添加边框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40195581/

相关文章:

HTML 电子邮件 : image adjust itself in table

css - 单击时选择整个 <td> 而不是仅选择其中的 <a>

html - IE 中的按钮颜色不会改变。 (背景图像 : linear-gradient)

HTML/CSS : Keeping Divs at same height

css - TYPO3 - 配置 tx_news 以使用样式 og Bootstrap Package CSS

javascript - z 索引和点击事件

css - 有没有办法在 CSS 中指定溢出?

javascript - 谷歌地图加载部分隐藏的信息窗口

javascript - 允许用户垂直调整 block 的大小并使其下方的所有内容向后/向前推

html - 更高的 z-index 不会改变堆叠顺序