CSS3箭头没有显示

时间:2012-06-01 01:57:41

标签: html css3 shapes

我正在尝试在右侧中心创建一个带箭头的框。到目前为止,我有以下代码,但它没有显示和想法?

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>

2 个答案:

答案 0 :(得分:5)

您应该查看css3arrowsplease

答案 1 :(得分:2)

以下内容对您有用:

<强> 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

查看以下博文,了解其工作原理:http://www.yuiblog.com/blog/2010/11/22/css-quick-tip-css-arrows-and-shapes-without-markup/