【问题标题】:Link button with arrow sides using css使用css的带有箭头边的链接按钮
【发布时间】:2017-12-19 08:57:33
【问题描述】:

我想知道是否有一个仅 css 的解决方案来显示如下所示的链接按钮。有什么建议吗?

【问题讨论】:

标签: css button


【解决方案1】:

您可以简单地使用伪元素和一些边框属性,然后调整不同的值以获得您想要的:

.link {
  padding: 10px;
  display: inline-block;
  width: 80px;
  border-top: 1px solid #000;
  border-bottom: 1px solid #000;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.link:before,.link:after {
  content: "";
  position: absolute;
  height: 30px;
  width: 30px;
  border: 1px solid #000;
  left: -19px;
  top: 3px;
  background: #fff;
  transform: rotate(45deg);
  transform-origin: center;
}
.link:after {
  right: -19px;
  left:auto;
}
<a href="#" class="link">link</a>

【讨论】:

  • 感谢您分享您的代码!你给我指明了正确的方向!在对伪元素应用一些缩放之后,我设法让它看起来和图像一模一样。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-09-23
  • 1970-01-01
  • 2018-11-09
  • 1970-01-01
  • 2012-09-20
  • 1970-01-01
相关资源
最近更新 更多