Posted in CSS
2139
11:33 pm, February 14, 2022
 

Using Marker to add a Triangle to List Items

In this demo i use the ::marker attribute on the list items to change the content of the marker to a ▶

HTML

<ul class="triangle-list">
  <li>List Item 1</li>
  <li>List Item 2</li>
  <li>List Item 3</li>  
</ul>

CSS

ul.triangle-list {
  margin: 0.75em 0;
  padding: 0 1em;
  list-style: none;
}
ul.triangle-list li::marker {
  content: "▶ ";
}
  • List Item 1
  • List Item 2
  • List Item 3

View Statistics
This Week
61
This Month
245
This Year
264

No Items Found.

Add Comment
Type in a Nick Name here
 
Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote


Random CSS Property

prefix

The prefix descriptor of the @counter-style rule specifies content that will be prepended to the marker representation. If not specified, the default value will be "" (an empty string).
prefix (@counter-style) css reference