Reputation: 4323
I am trying to make a right arrow head alone with a title without using an image. But I can not figure it out. Hope someone will help me out.
HTML :
<h4>This is for My Title</h4>
CSS :
h4 {
color: #666;
background: red;
width: 250px;
display: block;
padding: 3px 10px;
}
h4:after {
content:" ";
width: 0;
height: 0;
border-top: 4px solid transparent;
border-bottom: 4px solid transparent;
border-left: 14px solid green;
margin: 0 10px;
}
This is JsFiddle
Any help will be greatly appreciated. Thank you.
Upvotes: 1
Views: 2407
Reputation: 201568
Use a suitable character like “▶” BLACK RIGHT-POINTING TRIANGLE (U+25B6), e.g. with
h4:after {
content:" \25b6";
}
Using an image is generally more reliable, though, since there are potential font issues with special characters. An image also lets you select the exact shape you want.
Upvotes: 1
Reputation: 7019
A good and more simpler way to achieve this would be to use the following HTML/CSS.
I have added an element into the H4
to be the placeholder for the arrowhead.
<h4>This is for My Title <span class="arrow-right"></span></h4>
.arrow-right {
width: 0;
height: 0;
border-top: 10px solid transparent;
border-bottom: 10px solid transparent;
border-left: 10px solid green;
display: inline-block;
}
Demo fiddle: http://jsfiddle.net/pratik136/FHShC/2/
CSS courtesy: http://css-tricks.com/snippets/css/css-triangle/
Upvotes: 1