I have a simple div on a page:
<div>Some Text</div>
Is it possible, with CSS, to make it finish as an arrow. Something like:
UPDATE
This is the result I see with web-tiki proposed solution:
See the cuts on the arrow?
Thank You, Miguel
Go ahead and see for yourself. Next you'll want to use the margin property to center the arrow on the div. You could also use the margin to give the arrow an offset from the center if that would work better for your design. After that, go ahead and set the height and width properties to zero.
Step 1) Add HTML: Example <p>Right arrow: <i class="arrow right"></i></p> <p>Left arrow: <i class="arrow left"></i></p> <p>Up arrow: <i class="arrow up"></i></p> <p>Down arrow: <i class="arrow down"></i></p> Step 2) Add CSS: Example .arrow { border: solid black;
Then you have to set a position value in order for the arrow to stay on that bottom border you set for the div. Without this value being set, your arrow will not show up where you think it will.
This is an arrow right option positioned at the top border of the page This arrow animation activates when hovered over. The icon head points towards the top border of the screen. This CSS arrow points to the right with an animation effect that activates when hovered over.
EDIT : If you need the arrow to adapt to the height of the text (considering it can display on several lines) You can use linear-gradient background for the arrow.
FIDDLE
This can make it :
FIDDLE
CSS :
div{ height:40px; background:red; color:#fff; position:relative; width:200px; text-align:center; line-height:40px; } div:after{ content:""; position:absolute; height:0; width:0; left:100%; top:0; border:20px solid transparent; border-left: 20px solid red; }
Check This
DEMO
HTML
<div class="text">Some Text<span class="arrow"></span> </div>
CSS
.text { background-color:#ff0000; color:#fff; display:inline-block; padding-left:4px; } .arrow { border-style: dashed; border-color: transparent; border-width: 0.20em; display: -moz-inline-box; display: inline-block; /* Use font-size to control the size of the arrow. */ font-size: 100px; height: 0; line-height: 0; position: relative; vertical-align: middle; width: 0; background-color:#fff; /* change background color acc to bg color */ border-left-width: 0.2em; border-left-style: solid; border-left-color: #ff0000; left:0.25em; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With