【问题标题】:How to make a button with outline of a dog bone using css?如何使用css制作带有狗骨轮廓的按钮?
【发布时间】:2018-05-28 21:30:58
【问题描述】:

我找了这个但是没找到。我正在制作一个宠物护理网站,我想制作一些骨头形状的按钮,同时仍然像普通按钮一样工作(悬停功能)。除了圆形或矩形按钮,有什么方法可以使轮廓变成骨头的形状?

谢谢!

【问题讨论】:

  • 对不起,如果我的帖子不够具体,我是 html 和 css 的新手。任何帮助将不胜感激!
  • 使用图片并通过 CSS 添加悬停功能
  • 谢谢,我会试试的!希望你有一个很棒的一天@boyd

标签: css button border unique outline


【解决方案1】:

如果您不想使用图像,这里是一个仅使用 HTML 和 CSS 制作的示例。

.bone{
  margin: 20px;
  position: relative;
  width: 150px;
  height: 60px;
  cursor: pointer;
  background: transparent;
  border: none;
}
.c1, .c2, .c3, .c4{
  background:#fff;
  height: 30px;
  width: 30px;
  border: 1px solid #000;
  border-radius: 50%;
  position:absolute;
}
.c1{
  left: 0;
  top: 0;
}
.c2{
  right: 0;
  top: 0;
}
.c3{
  left: 0;
  bottom: 0;
}
.c4{
  bottom: 0;
  right: 0;
}
.b1 {
  background:#fff;
  height: 30px;
  width: 120px;
  position:absolute;  
  left: 15px;
  top: 15px;
}
.b2 {
  position: absolute;
  left: 15px;
  top: 0;
  width: 90px;
  height: 30px;
  line-height: 30px;
  border-top: 1px solid black;
  border-bottom: 1px solid black;
  text-align: center;
}
<button class="bone">
    <div class="c1"></div>
    <div class="c2"></div>
    <div class="c3"></div>
    <div class="c4"></div>
    <div class="b1">
      <div class="b2">
        Button Text
      </div>
    </div>
</button>

【讨论】:

  • 非常感谢!这太棒了——正是我想要的。
猜你喜欢
  • 1970-01-01
  • 2020-10-10
  • 1970-01-01
  • 1970-01-01
  • 2021-01-05
  • 2015-06-09
  • 2021-07-16
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多