更改 Twitter Bootstrap 中按钮的形状(“箭头”后退按钮)?

发布于 2025-01-07 18:48:48 字数 64 浏览 1 评论 0原文

我想知道是否有任何方法可以更改引导按钮的形状,以获得如下内容:

有什么建议吗?

I would like to know if there is any way to change the shape of a bootstrap button, to get something like this:

back button gmail

Any tips?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

待"谢繁草 2025-01-14 18:48:48

除非您使用图像和 :after 伪元素,否则您不会在按钮的乳头尖端获得圆形边缘,但您可以通过使用 css 三角形来接近它。这是我制作的简短演示,它使用一些颜色技巧来接近这种效果:

CSS

button.btn {
    position:relative;
}

button.btn:after {
    content: " ";
    display: block;
    width: 0;
    height: 0;
    border-top: 14px solid transparent;
    border-bottom: 14px solid transparent;
    border-right: 14px solid #e2e2e2;
    position: absolute;
    top: 50%;
    margin-top: -14px;
    right: 98%;
    z-index: 2;
}

button.btn:before {
    content: " ";
    display: block;
    width: 0;
    height: 0;
    border-top: 14px solid transparent;
    border-bottom: 14px solid transparent;
    border-right: 14px solid #A0A0A0;
    position: absolute;
    top: 50%;
    margin-top: -14px;
    right: 97%;
    z-index: 1;
}

.btn-primary {
    background: #e2e2e2; /* Old browsers */
    background: -moz-linear-gradient(left, #e2e2e2 0%, #d1d1d1 47%, #fefefe 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, right top, color-stop(0%,#e2e2e2), color-stop(47%,#d1d1d1), color-stop(100%,#fefefe)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(left, #e2e2e2 0%,#d1d1d1 47%,#fefefe 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(left, #e2e2e2 0%,#d1d1d1 47%,#fefefe 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(left, #e2e2e2 0%,#d1d1d1 47%,#fefefe 100%); /* IE10+ */
    background: linear-gradient(left, #e2e2e2 0%,#d1d1d1 47%,#fefefe 100%); /* W3C */
    text-shadow: 0 -1px 0 #fff;
    color:#777;
    border: 1px solid #A0A0A0;
}

我没有包含 :hover:active状态样式,以便您可以使用 Colorzilla 渐变生成器来混合一些颜色。

以下是该按钮的演示:

http://jsfiddle.net/WUn26/

You won't get that rounded edge on the tip of the nipple of the button unless you use an image and the :after pseudo-element but you can come close to it by using css triangles. Here is short demo i made that uses some color trickery to come close to that effect:

CSS

button.btn {
    position:relative;
}

button.btn:after {
    content: " ";
    display: block;
    width: 0;
    height: 0;
    border-top: 14px solid transparent;
    border-bottom: 14px solid transparent;
    border-right: 14px solid #e2e2e2;
    position: absolute;
    top: 50%;
    margin-top: -14px;
    right: 98%;
    z-index: 2;
}

button.btn:before {
    content: " ";
    display: block;
    width: 0;
    height: 0;
    border-top: 14px solid transparent;
    border-bottom: 14px solid transparent;
    border-right: 14px solid #A0A0A0;
    position: absolute;
    top: 50%;
    margin-top: -14px;
    right: 97%;
    z-index: 1;
}

.btn-primary {
    background: #e2e2e2; /* Old browsers */
    background: -moz-linear-gradient(left, #e2e2e2 0%, #d1d1d1 47%, #fefefe 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, right top, color-stop(0%,#e2e2e2), color-stop(47%,#d1d1d1), color-stop(100%,#fefefe)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(left, #e2e2e2 0%,#d1d1d1 47%,#fefefe 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(left, #e2e2e2 0%,#d1d1d1 47%,#fefefe 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(left, #e2e2e2 0%,#d1d1d1 47%,#fefefe 100%); /* IE10+ */
    background: linear-gradient(left, #e2e2e2 0%,#d1d1d1 47%,#fefefe 100%); /* W3C */
    text-shadow: 0 -1px 0 #fff;
    color:#777;
    border: 1px solid #A0A0A0;
}

I did not include the :hover and :active state styles so you can play around mixing some colors by using the Colorzilla gradient generator.

Here is a demo of what the button looks like:

http://jsfiddle.net/WUn26/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文