Jess McKenzie
Jess McKenzie

Reputation: 8385

CSS3 Arrow not showing

I am trying to create a box with an arrow on its right center. So far I have the following code but its not showing and ideas?

CSS:

    .pageHelp{
    float:right;
    margin:10px 20px 0 0;
    width:85px;
    height:25px;
    border-radius:3px;
    background-color:#354E69;
}
.pageHelp p{
    color:#000;
    padding:5px;
    text-align:center;
}
.pageHelp .arrow{
    width:0;
    height:0;
    border-top:3px solid transparent;
    border-bottom:3px solid transparent;
    border-left:3px solid #354E69;
}

HTML:

<div class="pageHelp arrow"><p>In Page Help</p></div>

Upvotes: 0

Views: 1703

Answers (2)

Josh Mein
Josh Mein

Reputation: 28645

The following should work for you:

CSS:

.pageHelp{
    float:right;
    margin:10px 20px 0 0;
    width:85px;
    height:50px;
    border-radius:3px;
    background-color:#354E69;
    position:relative;
}

.pageHelp p{
    color:#000;
    padding:5px;
    text-align:center;
}

.pageHelp:after {
    content: ' ';
    height: 0;
    position: absolute;
    left:10px;
    width: 0;

    border: 10px solid transparent;
    border-left-color: #354E69;
    left: 100%;
    top: 50%;
    margin-top: -10px;
}​

HTML:

<div class="pageHelp"><p>In Page Help</p></div>​

Live Demo

Check out the following blog post to understand how this works: http://www.yuiblog.com/blog/2010/11/22/css-quick-tip-css-arrows-and-shapes-without-markup/

Upvotes: 2

Aaditi Sharma
Aaditi Sharma

Reputation: 766

You should check out css3arrowsplease

Upvotes: 5

Related Questions