How can i make an arrow triangle using CSS without any cut in the side i.e. smooth sides? -
i want ask how can create css arrow triangle smooth sides i.e. no cut in side of arrow without using image? have tried tutorial -
http://css-tricks.com/snippets/css/css-triangle/
i have following css -
.arrow_up { width: 0; height: 0; border-left: 10px solid transparent; border-right: 10px solid transparent; border-bottom: 10px solid black; position:absolute; top:75px; left:250px; }
and html -
<div class="arrow_up"></div>
output -
you can see right hand side border of arrow not smooth - there little cut. how can resolve it?
you need use pseudo element , rotate it: demo
css:
.arrow_up { width: 100px; height: 50px; position:absolute; top:150px; left:250px; overflow:hidden;/* hide part of pseudo overflowing*/ } .arrow_up:before { content:''; position:absolute; width:100%; padding-top:100%;/* draw square , change value other degrees angles*/ transform:rotate(45deg);/* we'll see corner */ background:black; top:20px;/* tune according size of parent or size seen */ }
do not forget add vendor-prefix or use script adds them automaticly.
the use o pseudo element allows add content in box : ie. http://codepen.io/gc-nomade/pen/gdoga
Comments
Post a Comment