2012-06-01 157 views
0

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

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

的http:// cssarrowplease .com/ –

+0

@AaditiSharma请将其作为回答发布 –

回答

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/