[英]How can I best accomplish this shape on a div with dynamic text inside it?
http://i.imgur.com/Sc1NnFp.png http://i.imgur.com/Sc1NnFp.png
I need to create that with CSS. 我需要用CSS创建它。 I can use an image if absolutely necessary, but either way it needs to be expandable (probably vertically is best for this one).
如果绝对必要,我可以使用图像,但是无论哪种方式,它都需要可扩展(可能最好是垂直扩展)。
http://jsfiddle.net/VR2WF/ http://jsfiddle.net/VR2WF/
<div id="cta">
<div class="callus">Call us today!</div>
<div class="phonenumber">404-555-5555</div>
</div>
#cta {
font-family: Arial, sans-serif;
font-weight: bold;
font-size: 20px;
padding: 10px 20px;
color: #FFF;
text-align: center;
text-transform: uppercase;
background: #232323;
max-width: 400px;
margin: auto;
}
.callus, .phonenumber {
display: inline-block;
}
Here is my solution: 这是我的解决方案:
http://codepen.io/Chovanec/pen/temKh http://codepen.io/Chovanec/pen/temKh
<div class="rib"><div class="text">Call us today</div><div class="arrow"><!-- --></div></div>
.rib .text {
font-family: sans-serif;
color: #fff;
background: #000;
padding: 20px 50px 5px 50px;
width: 500px;
font-size: 20px;
text-transform: uppercase;
font-weight: bold;
text-align: center;
}
.rib .arrow {
display: block;
border-width: 20px 300px 0 300px;
border-color: transparent;
border-top-color: #000;
border-style: solid;
height: 0;
width: 0;
overflow: hidden;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.