font awesome trash can

Font Awesome Trash Can Icons

By Joseph Lewis
AD

Imagine wanting to design a website with a trash can icon to represent deletion or recycling. Wouldn't it be nice to add that icon with a simple piece of code instead of uploading an image? Enter Font Awesome, the popular icon tool kit that allows you to do just that. In this article, we'll explore how to use Font Awesome's trash can icon in your projects.

Font Awesome offers over a thousand icons ranging from basic shapes to complex emoji-like symbols. Its trash can icon, represented by the "trash-alt" class, is an excellent example of the versatility and simplicity of the library.

Getting Started with Font Awesome

Before diving into the trash can icon, let's ensure you have Font Awesome installed. If you haven't already, include the Font Awesome kit in your HTML file's section:

AD
a trash can that has been filled with garbage and the word trash is written on it
a trash can that has been filled with garbage and the word trash is written on it
Trash Decal, Vinyl Sticker Label for Trash Can, Garbage Barrel Decal, Trash Vinyl Decal, Trash and Recycle Bin Label, Trash Sign, DECAL ONLY - Etsy
Trash Decal, Vinyl Sticker Label for Trash Can, Garbage Barrel Decal, Trash Vinyl Decal, Trash and Recycle Bin Label, Trash Sign, DECAL ONLY - Etsy
thank me later!
thank me later!

<script src="https://kit.fontawesome.com/your_init.js" crossorigin="anonymous"></script>

Using the Trash Can Icon

Now, you're ready to use the trash can icon. Add the "trash-alt" class to an tag, like so:

a black background with the words, one man's trash is a designer's treasure
a black background with the words, one man's trash is a designer's treasure
Trash Font Family
Trash Font Family
the word trash written in black and white
the word trash written in black and white

<i class="fas fa-trash-alt"></i>

This will display the trash can icon. The "fas" class is for solid icons, but you can replace it with "far" for outline icons.

Changing the Icon Color and Size

You can easily customize the color and size of the trash can icon. For instance, to change the color to red:

<i class="fas fa-trash-alt" style="color: red;"></i>

And to increase the size to 3x:

<i class="fas fa-trash-alt" style="font-size: 3em;"></i>

Using the Trash Can Icon as a Button

Font Awesome offers a button component that you can use alongside the trash can icon.

First, add the button class:

<button class="btn btn-danger"></button>

Then, add the trash can icon inside the button:

<button class="btn btn-danger"><i class="fas fa-trash-alt"></i></button>

The "btn btn-danger" classes provide the trash can button's distinctive red color.

Adding Interactive Functionality

Now that you have a functional trash can button, you can add an interactive feature, such as deleting an item when clicked. Here's a simple example using JavaScript:

<script>
    document.querySelector('.btn-danger').addEventListener('click', function() {
        alert('Item deleted!');
    });
</script>

When the trash can button is clicked, it will display an "Item deleted!" alert. Replace this with your desired functionality, like removing an item from a list.

Remember, the trash can icon is just one of many icons in the Font Awesome library. Explore the full collection to enhance your projects with a wide range of symbols and glyphs.

TRASH / Typography Design Tapestry
TRASH / Typography Design Tapestry
Trashed Typeface - Svgfont by Giemons™ | Creative Market
Trashed Typeface - Svgfont by Giemons™ | Creative Market
trash can with the word trash on it in white and black letters, against a white background
trash can with the word trash on it in white and black letters, against a white background
a trash can with writing on it and plastic wrap around the top that says it is not what it is its what it can become
a trash can with writing on it and plastic wrap around the top that says it is not what it is its what it can become
a pink trash can with the words gettin trash on it sitting in front of a brick wall
a pink trash can with the words gettin trash on it sitting in front of a brick wall
two black trash cans sitting next to each other
two black trash cans sitting next to each other
Across the Line – Trash and Rebel Typeface
Across the Line – Trash and Rebel Typeface
some cool font's use to make this image look like it is in the air
some cool font's use to make this image look like it is in the air
the word trosh in pink and grey
the word trosh in pink and grey
the word trash is painted in red and black on a white background with spray paint
the word trash is painted in red and black on a white background with spray paint
the fancy trash bag font is black and white with letters that are drawn in it
the fancy trash bag font is black and white with letters that are drawn in it
the letters are made out of different types of food wrappers and candy bars,
the letters are made out of different types of food wrappers and candy bars,
trash metal font (100% free)
trash metal font (100% free)
Slide Tackle Font - Free Font
Slide Tackle Font - Free Font
Trash. Poster
Trash. Poster
Internet reference
Internet reference
50+ Top Graffiti Fonts for Urban-Inspired Graphic Design - Graphic Design Junction
50+ Top Graffiti Fonts for Urban-Inspired Graphic Design - Graphic Design Junction
a stainless steel trash can with the letter b on it
a stainless steel trash can with the letter b on it
AD