How to add SVG icon as list item bullets

svg-icons-list-item-bullets

Add this sample CSS:

ul.brxe-list {
	list-style: none;
	padding-left: 0;
}

ul.brxe-list li {
	padding-left: 1.5em;
	margin-bottom: 0.5em;
}

ul.brxe-list li::before {
	content: '';
	position: absolute;
	left: 0;
	top: 6px;
	width: 1em;
	height: 1em;
	background-repeat: no-repeat;
	background-image: url("data:image/svg+xml;utf8,<?xml version='1.0' encoding='utf-8'?><svg aria-hidden='true' focusable='false' data-prefix='fas' data-icon='check-circle' class='svg-inline--fa fa-check-circle fa-w-16' role='img' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path fill='%2315aabf' d='M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z'></path></svg>");
}

Replace brxe-list with the class of your ul element.

Here’s how you can generate the value of background-image property:

Copy your SVG’s HTML (open the .svg file in a code/text editor to view the HTML) and paste it in the URL-encoder for SVG page in the “Insert SVG” field.

Click “Copy” of the “Ready for CSS:” field.

Paste it in the above code replacing:

background-image: url("data:image/svg+xml;utf8,<?xml version='1.0' encoding='utf-8'?><svg aria-hidden='true' focusable='false' data-prefix='fas' data-icon='check-circle' class='svg-inline--fa fa-check-circle fa-w-16' role='img' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path fill='%2315aabf' d='M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z'></path></svg>")
Get access to all 526 Bricks code tutorials with BricksLabs Pro

17 comments

  • Dariusz Dominczak

    It works, thanks. Is there a way to change the icon's fill colour in the generated CSS? Here is my CSS:

    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24' color='%23000000' fill='none'%3E%3Cpath opacity='0.4' d='M22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12Z' fill='currentColor' /%3E%3Cpath d='M17 3.33782C15.5291 2.48697 13.8214 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 11.3151 21.9311 10.6462 21.8 10' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' /%3E%3Cpath d='M8 12.5C8 12.5 9.5 12.5 11.5 16C11.5 16 17.0588 6.83333 22 5' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' /%3E%3C/svg%3E")

  • Hi, I tried doing this and this is what the result is.

    https://codepen.io/gagandeepgill/pen/JjzGLya

  • Tobias

    Sorry, I am a noob.

    After adding the css you mentioned, how should I refer to it in the html?

    Is it like this:

    test

  • Hello.

    Im duplicating the comment again, because I didnt inserted the links properly.

    I'm trying to add SVG icon as list item bullets

    I followed your tutorial but for me is not working.

    here is the website: https://eduonline.one/test-bullets/

    I'm using WPCode box with those settings: https://drive.google.com/file/d/1dQUuQSwjmni2hWTm0P3Nar728Sf1gGRc/view

    Here is the code which I inserted:

    ul.brxe-aoegwo {
    list-style: none;
    padding-left: 0;
    }

    ul.brxe-aoegwo li {
    padding-left: 1.5em;
    margin-bottom: 0.5em;
    }

    ul.brxe-aoegwo li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    width: 1em;
    height: 1em;
    background-repeat: no-repeat;
    background-image: url("https://eduonline.one/wp-content/uploads/2022/09/done-button.svg%22);
    }

    Could you help me please?

  • I'm trying to add SVG icon as list item bullets

    I followed your tutorial but for me is not working.

    here is the webiste: https://eduonline.one/test-bullets/

    Im using WPCode box with those settings: https://drive.google.com/.../1dQUuQSwjmni2hWTm0P3Nar.../view

    Here is the code which I inserted:

    ul.brxe-aoegwo {
    list-style: none;
    padding-left: 0;
    }
    ul.brxe-aoegwo li {
    padding-left: 1.5em;
    margin-bottom: 0.5em;
    }
    ul.brxe-aoegwo li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    width: 1em;
    height: 1em;
    background-repeat: no-repeat;
    background-image: url("https://eduonline.one/wp.../uploads/2022/09/done-button.svg");
    }
    Could you help me?

  • Can I target Text List in Meta Box with this?
    Text List > > Inputs " Label " > Cloneable!

  • Aljaz Bizjak

    Tried that, but only the first icon gets shown.

Leave your comment

 

Related Tutorials..

Pro
Search Results Template in Bricks

Search Results Template in Bricks

Updated on 26 Oct 2023 This Pro tutorial provides the steps to set up a search template in Bricks with these features: Step 1 Create…
Read more โ†’
Categories:
Pro
How to Combine Multiple Menus into Bricks’ Mobile Menu

How to Combine Multiple Menus into Bricks’ Mobile Menu

Bricks' native 'Nav Menu' element comes with a built-in mobile menu, which shrinks the menu down to a menu toggle button to open an offcanvas…
Read more โ†’
Categories:
Pro
Floating Bottom Div when Scrolling Down in Bricks

Floating Bottom Div when Scrolling Down in Bricks

Creating a floating call to action element that reveals only as the user scrolls down.
Read more โ†’
Categories:
Tags:
How to create filters with IsotopeJS in Bricks (Part 1)

How to create filters with IsotopeJS in Bricks (Part 1)

This tutorial series will explore the IsotopeJS library's features inside the Bricks ecosystem.
Read more โ†’
Categories:
Pro
Horizontal Scrolling Tabs in Bricks

Horizontal Scrolling Tabs in Bricks

Nestable Tabs element in Bricks wraps into multiple lines out of the box at smaller viewport widths. This Pro tutorial provides the steps to remove…
Read more โ†’
Categories:
Tags:
Pro
Stripe’s Animated Gradient in Bricks

Stripe’s Animated Gradient in Bricks

This Pro tutorial provides the steps to set up an animated gradient as a background of a section in Bricks using the code generated by…
Read more โ†’
Categories:
Pro
“Pro” Category Ribbon for Posts in Bricks

“Pro” Category Ribbon for Posts in Bricks

This Pro tutorial provides the steps to show a "Pro" ribbon for posts that are categorized under the "Pro" category when using Bricks builder. Step…
Read more โ†’
Categories:
Pro
New Ribbon for Posts in Bricks

New Ribbon for Posts in Bricks

This Pro tutorial provides the steps to display a "New" ribbon for posts that were published in the last x days in Bricks. Update: Added…
Read more โ†’
Categories:
Tags:
Pro
Centered Image Logo in Bricks

Centered Image Logo in Bricks

Updated on 8 Mar 2023 This Pro tutorial provides the steps to add a logo image as the center menu item that shrinks when the…
Read more โ†’
Categories: