You can use the before or after pseudo-element and apply some CSS to it. There are various ways. You can add both before and after, and rotate and position each of them to form one of the bars. An easier solution is adding two borders to just the before element and rotate it using transform: rotate.

Scroll down for a different solution that uses an actual element instead of the pseuso elements

In this case, I've added the arrows as bullets in a list and used em sizes to make them size properly with the font of the list.

ul {
    list-style: none;
}

ul.big {
    list-style: none;
    font-size: 300%
}

li::before {
    position: relative;
    /* top: 3pt; Uncomment this to lower the icons as requested in comments*/
    content: "";
    display: inline-block;
    /* By using an em scale, the arrows will size with the font */
    width: 0.4em;
    height: 0.4em;
    border-right: 0.2em solid black;
    border-top: 0.2em solid black;
    transform: rotate(45deg);
    margin-right: 0.5em;
}

/* Change color */
li:hover {
  color: red; /* For the text */
}
li:hover::before {
  border-color: red; /* For the arrow (which is a border) */
}
<ul>
    <li>Item1</li>
    <li>Item2</li>
    <li>Item3</li>
    <li>Item4</li>
</ul>

<ul class="big">
    <li>Item1</li>
    <li>Item2</li>
    <li>Item3</li>
    <li>Item4</li>
</ul>

Of course you don't need to use before or after, you can apply the same trick to a normal element as well. For the list above it is convenient, because you don't need additional markup. But sometimes you may want (or need) the markup anyway. You can use a div or span for that, and I've even seen people even recycle the i element for 'icons'. So that markup could look like below. Whether using <i> for this is right is debatable, but you can use span for this as well to be on the safe side.

/* Default icon formatting */
i {
  display: inline-block;
  font-style: normal;
  position: relative;
}

/* Additional formatting for arrow icon */
i.arrow {
    /* top: 2pt; Uncomment this to lower the icons as requested in comments*/
    width: 0.4em;
    height: 0.4em;
    border-right: 0.2em solid black;
    border-top: 0.2em solid black;
    transform: rotate(45deg);
}
And so you can have an <i class="arrow" title="arrow icon"></i> in your text.
This arrow is <i class="arrow" title="arrow icon"></i> used to be deliberately lowered slightly on request.
I removed that for the general public <i class="arrow" title="arrow icon"></i> but you can uncomment the line with 'top' <i class="arrow" title="arrow icon"></i> to restore that effect.

If you seek more inspiration, make sure to check out this awesome library of pure CSS icons by Nicolas Gallagher. :)

Answer from GolezTrol on Stack Overflow
Top answer
1 of 10
104

You can use the before or after pseudo-element and apply some CSS to it. There are various ways. You can add both before and after, and rotate and position each of them to form one of the bars. An easier solution is adding two borders to just the before element and rotate it using transform: rotate.

Scroll down for a different solution that uses an actual element instead of the pseuso elements

In this case, I've added the arrows as bullets in a list and used em sizes to make them size properly with the font of the list.

ul {
    list-style: none;
}

ul.big {
    list-style: none;
    font-size: 300%
}

li::before {
    position: relative;
    /* top: 3pt; Uncomment this to lower the icons as requested in comments*/
    content: "";
    display: inline-block;
    /* By using an em scale, the arrows will size with the font */
    width: 0.4em;
    height: 0.4em;
    border-right: 0.2em solid black;
    border-top: 0.2em solid black;
    transform: rotate(45deg);
    margin-right: 0.5em;
}

/* Change color */
li:hover {
  color: red; /* For the text */
}
li:hover::before {
  border-color: red; /* For the arrow (which is a border) */
}
<ul>
    <li>Item1</li>
    <li>Item2</li>
    <li>Item3</li>
    <li>Item4</li>
</ul>

<ul class="big">
    <li>Item1</li>
    <li>Item2</li>
    <li>Item3</li>
    <li>Item4</li>
</ul>

Of course you don't need to use before or after, you can apply the same trick to a normal element as well. For the list above it is convenient, because you don't need additional markup. But sometimes you may want (or need) the markup anyway. You can use a div or span for that, and I've even seen people even recycle the i element for 'icons'. So that markup could look like below. Whether using <i> for this is right is debatable, but you can use span for this as well to be on the safe side.

/* Default icon formatting */
i {
  display: inline-block;
  font-style: normal;
  position: relative;
}

/* Additional formatting for arrow icon */
i.arrow {
    /* top: 2pt; Uncomment this to lower the icons as requested in comments*/
    width: 0.4em;
    height: 0.4em;
    border-right: 0.2em solid black;
    border-top: 0.2em solid black;
    transform: rotate(45deg);
}
And so you can have an <i class="arrow" title="arrow icon"></i> in your text.
This arrow is <i class="arrow" title="arrow icon"></i> used to be deliberately lowered slightly on request.
I removed that for the general public <i class="arrow" title="arrow icon"></i> but you can uncomment the line with 'top' <i class="arrow" title="arrow icon"></i> to restore that effect.

If you seek more inspiration, make sure to check out this awesome library of pure CSS icons by Nicolas Gallagher. :)

2 of 10
81

This can be solved much easier than the other suggestions.

Simply draw a square and apply a border property to just 2 joining sides.

Then rotate the square according to the direction you want the arrow to point, for exaple: transform: rotate(<your degree here>)

.triangle {
    border-right: 10px solid; 
    border-bottom: 10px solid;
    height: 30px;
    width: 30px;
    transform: rotate(-45deg);
}
<div class="triangle"></div>

🌐
Toptal
toptal.com › designers › htmlarrows
HTML Symbols, Entities, Characters and Codes — HTML Arrows
Easily find HTML symbols, entities, characters and codes with ASCII, HEX, CSS and Unicode values for HTML arrow, ASCII arrow, and more in grid or table format.
Discussions

css - What is the HTML unicode character for a "tall" right chevron? - Stack Overflow
I am looking for a unicode right chevron character, with no handle on the left, and I would like the top point and bottom point to be spread far apart. Similar to Ubuntu's (website) arrow in the se... More on stackoverflow.com
🌐 stackoverflow.com
css - What characters can be used for up/down triangle (arrow without stem) for display in HTML? - Stack Overflow
WARDS ARROW WITH TAIL WITH VERTICAL ... ARROW ABOVE REVERSE TILDE OPERATOR U+2B50 ⭐ WHITE MEDIUM STAR U+2B51 ⭑ BLACK SMALL STAR U+2B52 ⭒ WHITE SMALL STAR U+2B53 ⭓ BLACK RIGHT-POINTING PENTAGON U+2B54 ⭔ WHITE RIGHT-POINTING PENTAGON U+2B55 ⭕ HEAVY LARGE CIRCLE U+2B56 ⭖ HEAVY OVAL WITH OVAL INSIDE U+2B57 ⭗ HEAVY CIRCLE WITH CIRCLE INSIDE U+2B58 ⭘ HEAVY CIRCLE U+2B59 ⭙ HEAVY CIRCLED SALTIRE · You can create the chevrons efficiently ... More on stackoverflow.com
🌐 stackoverflow.com
html - creating a chevron in CSS - Stack Overflow
I'm looking at how to create a chevron (not a triangle) in CSS. More on stackoverflow.com
🌐 stackoverflow.com
The arrow in the chevron icon in the Collapsible's section will not show - HTML/CSS - Code with Mosh Forum
Hello anyone who can help! In the Collapsible section for The Ultimate HTML5, the arrow in the chevron icon will not show and I have tried to do everything to make it show. If someone could lead me in the right direction, it would be much appreciated! Thank you! More on forum.codewithmosh.com
🌐 forum.codewithmosh.com
0
May 26, 2022
🌐
W3Schools
w3schools.com › charsets › ref_utf_arrows.asp
HTML Unicode Arrows
Entities Latin Entities Greek Entities A Entities B Entities C Entities D Entities E Entities F Entities G Entities H Entities I Entities J Entities K Entities L Entities M Entities N Entities O Entities P Entities Q Entities R Entities S Entities T Entities U Entities V Entities W Entities X Entities Y Entities Z HTML4 ... <p>I will display &larr;</p> <p>I will display &#8592;</p> <p>I will display &#x2190;</p> Try it Yourself » · Some of the arrows above, also has an HTML entity code:
🌐
CodePen
codepen.io › wsky › pen › BKoKxV
Pure css chevron arrows
#chevron-arrow-left { display: inline-block; border-right: 4px solid black; border-bottom: 4px solid black; width: 10px; height: 10px; transform: rotate(-225deg); } #chevron-arrow-right { display: inline-block; border-right: 4px solid black; border-bottom: 4px solid black; width: 10px; height: 10px; transform: rotate(-45deg); } /* #chevron { position: relative; top: 100px; text-align: center; padding: 10px; margin-bottom: 6px; height: 2px; width: 30px; -webkit-transform: rotate(90deg); -moz-transform: rotate(90deg); -ms-transform: rotate(90deg); -o-transform: rotate(90deg); transform: rotate(9
🌐
GeeksforGeeks
geeksforgeeks.org › web templates › how-to-create-a-chevron-arrow-using-css
How to create a Chevron Arrow using CSS ? - GeeksforGeeks
January 8, 2024 - Set the transformations to rotate ... 45 degrees counter-clockwise. The transform: rotate() property is used to change the direction of the chevron, creating an arrow-like appearance....
🌐
Toptal
toptal.com › designers › htmlarrows › arrows
HTML Arrow Symbols, Entities and Codes — Toptal Designers
Easily find HTML arrow symbols, entities, characters and codes with ASCII, HEX, CSS and Unicode values; including right arrow, left arrow, up and down arrows.
Find elsewhere
🌐
HTML Symbols
htmlsymbols.xyz › arrow-symbols
Arrow Symbols - HTML Symbols
The following table shows Unicode symbol, HTML code, CSS code, and official HTML name for the characters categorized under arrow symbols.
🌐
W3Schools
w3schools.com › icons › tryit.asp
W3Schools online HTML editor
The W3Schools online code editor allows you to edit code and view the result in your browser
🌐
HubSpot
community.hubspot.com › t5 › CMS-Development › Change-Button-to-Chevron-Arrow › m-p › 819606
Solved: HubSpot Community - Change Button to Chevron Arrow - HubSpot Community
July 13, 2023 - If you'd like the contents of that anchor tag to be an icon instead of "Click Me", you can set its inner HTML to an <img> tag instead, and linking the desired image from your hubspot files' url. <a href="#scroll_to_me"><img src="url_of_your_img_file.svg" alt="chevron-arrow"></a> Check this link out for more info.
🌐
Unicode Compart
compart.com › en › unicode › U+203A
Find all Unicode Characters from Hieroglyphs to Dingbats – Unicode Compart
U+203A is the unicode hex value of the character Single Right-Pointing Angle Quotation Mark. Char U+203A, Encodings, HTML Entitys:›,›,›, UTF-8 (hex), UTF-16 (hex), UTF-32 (hex)
🌐
Bootstrap
icons.getbootstrap.com › icons › chevron-right
Chevron right · Bootstrap Icons
<i class="bi bi-chevron-right"></i> Unicode: U+F285 · CSS: \F285 · JS: \uF285 · HTML: &#xF285; Paste the SVG right into your project's code.
🌐
Code with Mosh
forum.codewithmosh.com › html/css
The arrow in the chevron icon in the Collapsible's section will not show - HTML/CSS - Code with Mosh Forum
May 26, 2022 - Hello anyone who can help! In the Collapsible section for The Ultimate HTML5, the arrow in the chevron icon will not show and I have tried to do everything to make it show. If someone could lead me in the right directi…
Top answer
1 of 3
1

To make the selected a tag has full border, I updated ul.chevrons li a.selected class. In this class, I added height to make the selected a has same height with other a tags. Then I added new classes top-border and bottom-botter and removed the gap created by :after and :before.

ul.chevrons li a.selected {
  border: 1.5px solid yellow;
  background-color: #013e75;
  color: #fff;
  height: calc(2.5em - 3px);
}

const selectedLink = document.querySelector('.chevrons li a.selected');

const topBorder = document.createElement('span');
topBorder.classList.add('top-border');

const bottomBorder = document.createElement('span');
bottomBorder.classList.add('bottom-border');

selectedLink.appendChild(topBorder);
selectedLink.appendChild(bottomBorder);
html {
  font-family: sans-serif;
  font-size: 1em;
  -ms-text-size-adjust: 1em;
  -webkit-text-size-adjust: 1em;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

body {
  margin: 0;
  font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
  line-height: 1.42857143;
  color: #333333;
  background-color: #ffffff;
}

#wrapper {
  width: 600px;
  margin: 50px auto;
}

ul.chevrons {
  padding: 0;
  margin: 0;
  height: 2.5em;
  font-size: 1.125em;
  background-color: #e3edf9;
  overflow: hidden;
  width: 100%;
}

ul.chevrons li {
  list-style: none;
  text-align: center;
  line-height: 2.5em;
  float: left;
}

ul.chevrons li {
  width: 25%;
  /* This changes based on how many items are in the flow. 3 items = 33% and 2 items = 50% */
}

ul.chevrons li a {
  width: 100%;
  color: #212121;
  text-decoration: none;
  display: inline-block;
  position: relative;
  text-indent: 0.75em;
}

ul.chevrons li a.selected {
  border: 1.5px solid yellow;
  background-color: #013e75;
  color: #fff;
  height: calc(2.5em - 3px);
}

ul.chevrons li a.previous {
  color: #6c6c6c;
}

ul.chevrons li a:before,
ul.chevrons li a:after {
  content: " ";
  display: block;
  width: 0;
  height: 0;
  border-top: 1.5em solid transparent;
  border-bottom: 1.5em solid transparent;
  position: absolute;
  top: 50%;
  margin-top: -1.5em;
  left: 100%;
}

ul.chevrons li a:before {
  border-left: 0.75em solid yellow;
  margin-left: -0px;
  z-index: 1;
}

ul.chevrons li a:after {
  border-left: 0.75em solid #e3edf9;
  margin-left: -2px;
  z-index: 2;
}

ul.chevrons li a.selected:after {
  border-left: 0.75em solid #013e75;
}

ul.chevrons li:last-child a:before,
ul.chevrons li:last-child a:after {
  display: none;
}

.top-border {
  position: absolute;
  top: -1.5px;
  width: 4px;
  height: 1.5px;
  background: yellow;
  right: -2px;
  z-index: 1000;
}

.bottom-border {
  position: absolute;
  bottom: -1.5px;
  width: 4px;
  height: 1.5px;
  background: yellow;
  right: -2px;
  z-index: 1000;
}
<div id="wrapper">
  <ul class="chevrons">
    <li><a href="#" class="previous">Step 1</a></li>
    <li><a href="#" class="selected">Step 2</a></li>
    <li><a href="#">Step 3</a></li>
    <li><a href="#">Step 4</a></li>
  </ul>
</div>

2 of 3
1

I have tried to do the same with different approach. And this is a bit easier to maintain and edit.

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-family: sans-serif;
  font-size: 1em;
  -ms-text-size-adjust: 1em;
  -webkit-text-size-adjust: 1em;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

body {
  margin: 0;
  font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
  line-height: 1.42857143;
  color: #333333;
  background-color: #ffffff;
}

#wrapper {
  width: 600px;
  margin: 50px auto;
}

ul.chevrons {
  padding: 0;
  margin: 0;
  height: 2.5em;
  font-size: 1.125em;
  background-color: #e3edf9;
  overflow: hidden;
  width: 100%;
}

ul.chevrons li {
  list-style: none;
  text-align: center;
  line-height: 2.5em;
  float: left;
  
  width: 25%;
  /* This changes based on how many items are in the flow. 3 items = 33% and 2 items = 50% */
  
  color: #FFF;
}

ul.chevrons li a,
ul.chevrons li a.selected {
  position: relative;
  display: block;
  z-index: 1;
  
  color: #333;
  text-decoration: none;
}

ul.chevrons li a.selected {
  color: #FFF;
}

ul.chevrons li a:before,
ul.chevrons li a:after,
ul.chevrons li a.selected:before,
ul.chevrons li a.selected:after {
  position: absolute;
  top: 0;
  content: "";
  height: 21px;
  width: 96%;
  display: block;
  border: 2px solid transparent;
    transform: skew(30deg);
  z-index: -1;
}

ul.chevrons li a:after,
ul.chevrons li a.selected:after {
  top: 21px;
  border-top: 0;
    transform: skew(-30deg);
}


ul.chevrons li a.selected:after,
ul.chevrons li a.selected:before {
  border: 2px solid #F00;
  background: #333;
}

ul.chevrons li a.selected:before {
  border-bottom: 0;
}

ul.chevrons li a.selected:after {
  border-top: 0;
}
<div id="wrapper">
  <ul class="chevrons">
    <li><a href="#" class="previous">Step 1</a></li>
    <li><a href="#" class="selected">Step 2</a></li>
    <li><a href="#">Step 3</a></li>
    <li><a href="#">Step 4</a></li>
  </ul>
</div>

🌐
W3C
w3c.github.io › wai-website-components › components › detail › icons--chevron-down.html
Icons: Chevron Down | WAI Website Assets
[class^="icon-"], [class*=" icon-"] { display: inline-block; width: 1em; height: 1em; stroke-width: 0; stroke: currentColor; fill: currentColor; } /* ========================================== Single-colored icons can be modified like so: .icon-name { font-size: 32px; color: red; } ========================================== */ .icon-default { width: 0.9285714285714285em; } .icon-info { width: 0.8571428571428571em; } .icon-audio-description { width: 3.5em; height: 1.75em; margin: -.25em; } .icon-search { width: 0.9287109375em; } .icon-arrow-left { width: 0.8928571428571428em; } .icon-arrow-righ
🌐
W3Schools
w3schools.com › icons › fontawesome_icons_directional.asp
Font Awesome Directional Icons
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING INTRO TO HTML & CSS BASH RUST TOOLS ... Font Awesome 5 Intro Icons Accessibility Icons Alert Icons Animals Icons Arrows Icons Audio & Video Icons Automotive Icons Autumn Icons Beverage Icons Brands Icons Buildings Icons Business Icons Camping Icons Charity Icons Chat Icons Chess Icons Childhood Icons Clothing Icons