【问题标题】:CSS - How to make rectangle with pointed sides? [duplicate]CSS - 如何制作带有尖边的矩形? [复制]
【发布时间】:2014-07-02 09:41:21
【问题描述】:

http://nl.tinypic.com/r/jgm90h/8

我想知道如何使用纯 CSS3 使 HTML 按钮标签具有上述链接中的形状。你们能帮帮我吗?

【问题讨论】:

  • ::before::after 与基本的CSS 三角形一起使用。

标签: html css button shape css-shapes


【解决方案1】:

诀窍是使用伪类:before:after。试试这样:

.yourButton {
    position: relative;
    width:200px;
    height:40px;
    margin-left:40px;
    color:#FFFFFF;
    background-color:blue;
    text-align:center;
    line-height:40px;
}

.yourButton:before {
    content:"";
    position: absolute;
    right: 100%;
    top:0px;
    width:0px;
    height:0px;
    border-top:20px solid transparent;
    border-right:40px solid blue;
    border-bottom:20px solid transparent;
}

.yourButton:after {
    content:"";
    position: absolute;
    left: 100%;
    top:0px;
    width:0px;
    height:0px;
    border-top:20px solid transparent;
    border-left:40px solid blue;
    border-bottom:20px solid transparent;
}

JsFiddle:http://jsfiddle.net/VpW5x/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-05-09
    • 1970-01-01
    • 2021-11-11
    • 2013-11-20
    • 2010-11-02
    • 1970-01-01
    • 2022-06-10
    相关资源
    最近更新 更多