J82
J82

Reputation: 8457

Is it possible to create a button pointing downward (image included) with only CSS?

I would like to create this using only CSS. Is this possible? If so, can you guys help me out?

enter image description here

Upvotes: 5

Views: 474

Answers (3)

Pete
Pete

Reputation: 58462

how about something like the following:

http://jsfiddle.net/WDCu3/

<div id="test">Testing</div>
<div id="arrow"></div>

#test {background-color:red; width:100px;}
div {text-align:center;}

#arrow {
    border-top: 15px solid red;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    height: 0;
    width:0;
}

Upvotes: 2

Turnip
Turnip

Reputation: 36742

Fairly easy with borders and a pseudo element:

<a href="#" id="button">ALL</a>

#button::after {
    content: "";
    border: 64px solid transparent;
    border-top: 12px solid orange;
    position: absolute;
    top: 29px;
    left: 0;
}

DEMO

Upvotes: 5

dfsq
dfsq

Reputation: 193301

Try to experiment with this basic button:

.btn {
    width: 100px;
    height: 30px;
    text-align: center;
    border: 0;
}
.btn-arrow {
    position: relative;
    background: coral;
}
.btn-arrow:after {
    border: solid transparent;
    content:"";
    position: absolute;
    border-top-color: coral;
    border-width: 16px 50px;
    left: 0px;
    top: 100%;
    margin-top: 0px;
}

http://jsfiddle.net/dfsq/tNjCb/1/

Upvotes: 3

Related Questions