Join

How To Easily Add Custom Icons to MyListing Websites for Free With Bootstrap

Don't want to mess with code snippets? Request for this to be a feature of MyListing Pro.

Instructions

  1. Create a new CSS code snippet.
  2. Copy the contents of code snippet below.
  3. Paste the contents into your code snippet.
  4. Review any notes that I’ve provided.
  5. Save and enable the code snippet.
  6. Test.

Snippet

Bootstrap Icon Library

A free, high-quality, open-source icon library with over 2,000 icons.

Add Icon Before Element

In this example, we add a ‘Calendar’ icon before an element. The CSS ID or CSS Class defines the element, and the ‘::before’ defines where the icon is placed in relation to it.

  1. Adjust Line 1, replacing ‘yourCSSelement’ with a CSS ID (e.g., #element) or CSS Class (.element).
  2. If you want to adjust the icon’s color, adjust the fill=’white’ value on Line 6.
  3. Optionally adjust other icon settings like the size, margins, etc.
yourCSSelement::before {
    content: "";
    width: 1rem;
    height: 1rem;
    margin-left: 10px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z'/%3E%3Cpath fill-rule='evenodd' d='M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z'/%3E%3C/svg%3E");
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    display: inline-block;
}
add bootstrap icons before element

Add Icon After Element

Everything here is the same as the code snippet above, with the one difference being the ‘::after’ declaration on Line 1

yourCSSelement::after {
    content: "";
    width: 1.1rem;
    height: 1.1rem;
    margin: 0px 0px -2px 10px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5M2 2a1 1 0 0 0-1 1v1h14V3a1 1 0 0 0-1-1zm13 3H1v9a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1z'/%3E%3Cpath fill-rule='evenodd' d='M11 7.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm-3 0a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm-2 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm-3 0a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5z'/%3E%3C/svg%3E");
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    display: inline-block;
}
add bootstrap icons after element

Change Icons

This is a bit hard to explain in words, but you can give it a go. Otherwise, watching the video should help make some sense of it.

  1. Bootstrap Icons
  2. Locate the desired icon.
  3. Copy HTML > Click the copy icon.
  4. From the copied HMTL, copy the contents of the first path, which is everything between the quotation marks (e.g., path d=” “).
  5. Paste the path contents into the code snippet above, replacing the first path.
  6. Repeat steps 4-5 for the second path.
  7. Save changes.

Video Tutorial

Youtube video