html - CSS3 navigation arrow -
i have navigation looks this:

the selected page has orange arrow made png image.my question can make arrow css/css3? code is:
nav ul li { display: block; padding: 25px 40px 25px; } nav ul li a{ color: #fff; text-decoration: none; font-size: 16px; } nav ul li.selected a{ color: #ef5a29; } nav ul li.selected{ background-image: url('../img/arrow.png'); background-position: right; background-repeat: no-repeat; }
using magic of :after pseudo object, don't need change html markup =)
you try that:
nav ul li.selected:after{ content:''; float:right; width: 0; height: 0; border-top: 16px solid transparent; border-bottom: 16px solid transparent; border-right: 20px solid #ef5a29; } or did in jsfiddle below:
nav ul li.selected a:after{ content:''; position:absolute; top:20px; right:0; width: 0; height: 0; border-top: 16px solid transparent; border-bottom: 16px solid transparent; border-right: 20px solid #ef5a29; } note moved padding li , added display:block a example.
here jsfiddle
Comments
Post a Comment