- Html css icon png
- Available in
- Features
- 4 Easy Ways to Add Icons In HTML CSS (Simple Examples)
- TLDR – QUICK SLIDES
- TABLE OF CONTENTS
- DOWNLOAD & NOTES
- QUICK NOTES
- EXAMPLE CODE DOWNLOAD
- ADDING HTML CSS ICONS
- METHOD 1) HTML SYMBOLS
- METHOD 2) ICON IMAGES
- 2A) FLAT IMAGE ICON
- 2B) IMAGE FONT SET
- METHOD 3) ICON FONT SET
- METHOD 4) ICON LIBRARIES
- 4A) FONT AWESOME
- 4B) MATERIAL ICONS
- EXTRA BITS & LINKS
- WHICH IS THE BEST METHOD?
- LINKS & REFERENCES
- INFOGRAPHIC CHEAT SHEET
- THE END
- 27 CSS Icons and Icon Sets
- Related Articles
- Table of Contents
- Icon Sets
- Author
- Links
- About a code
- Tabler Icons
- Author
- Links
- About a code
- css.gg
- Author
- Links
- About a code
- Unicons
- Author
- Links
- About a code
- icons.css
- Author
- Links
- About a code
- Font Awesome
- Author
- Links
- About a code
- iConicss
- Author
- Links
- About a code
- Gov Icons
- Author
Html css icon png
Open-source CSS, SVG and Figma UI Icons
Available in SVG Sprite, styled-components, NPM & API
Version: v2.0 — Total weight: 316kb
1 | .gg-chevron-down-r |
2 | box-sizing: border-box; |
3 | position: relative; |
4 | display: block; |
5 | transform: scale(var(—ggs, 1 )); |
6 | width: 22px ; |
7 | height: 22px ; |
8 | border: 2px solid; |
9 | border-radius: 4px |
10 | > |
11 | |
12 | .gg-chevron-down-r ::after |
13 | content: «»; |
14 | display: block; |
15 | box-sizing: border-box; |
16 | position: absolute; |
17 | width: 6px ; |
18 | height: 6px ; |
19 | border-bottom: 2px solid; |
20 | border-right: 2px solid; |
21 | transform: rotate( 45deg ); |
22 | left: 6px ; |
23 | top: 5px |
24 | > |
1 | .gg-globe-alt, |
2 | .gg-globe-alt ::after , |
3 | .gg-globe-alt ::before |
4 | display: block; |
5 | box-sizing: border-box; |
6 | height: 18px ; |
7 | border: 2px solid |
8 | > |
9 | |
10 | .gg-globe-alt |
11 | position: relative; |
12 | transform: scale(var(—ggs, 1 )); |
13 | width: 18px ; |
14 | border-radius: 22px |
15 | > |
16 | |
17 | .gg-globe-alt ::after , |
18 | .gg-globe-alt ::before |
19 | content: «»; |
20 | position: absolute; |
21 | width: 8px ; |
22 | border-radius: 100% ; |
23 | top: -2px ; |
24 | left: 3px |
25 | > |
26 | |
27 | .gg-globe-alt ::after |
28 | width: 24px ; |
29 | height: 20px ; |
30 | border: 2px solid transparent; |
31 | border-bottom: 2px solid; |
32 | top: -11px ; |
33 | left: -5px |
34 | > |
Available in
Features
700 Precise and Detailed UI Icons — provided with well-organized Figma components library.
4 Easy Ways to Add Icons In HTML CSS (Simple Examples)
Welcome to a beginner’s tutorial on how to add icons in HTML and CSS. Need to add some icons to your website? Make the contents a little easier to navigate?
There are various ways to add icons in HTML and CSS:
- The easiest way is to use HTML symbols, simply copy-and-paste the respective HTML entity code. For example, ★ represents a star symbol.
- Download icons images from websites such as FlatIcon, and use them as-it-is. E.G.
- Use a set of font icons, such as Webdings. E.G.
ABC
- Lastly, load and use icon libraries such as Font Awesome and Material Icons.
But just how are these done exactly? Let us walk through some examples in this guide – Read on to find out!
ⓘ I have included a zip file with all the example source code at the start of this tutorial, so you don’t have to copy-paste everything… Or if you just want to dive straight in.
TLDR – QUICK SLIDES
TABLE OF CONTENTS
DOWNLOAD & NOTES
Firstly, here is the download link to the example code as promised.
QUICK NOTES
If you spot a bug, feel free to comment below. I try to answer short questions too, but it is one person versus the entire world… If you need answers urgently, please check out my list of websites to get help with programming.
EXAMPLE CODE DOWNLOAD
Click here to download the source code, I have released it under the MIT license, so feel free to build on top of it or use it in your own project.
ADDING HTML CSS ICONS
All right, let us now get into the various methods on how to add icons in HTML and CSS.
METHOD 1) HTML SYMBOLS
★ STAR! ☂ Weather report. ☃ Do you want to build a snowman? ☻ Happy face.
What kind of sorcery is this? Well, these are HTML symbols, and there are a ton of these – Everything from arrows, to symbols, to currencies, to smilies, and more. The best part is that they are baked straight into native HTML, and we don’t need to load 3rd party frameworks for these to work.
The usage is very simple, just define &#NUMBER; and it will “translate” into the respective HTML symbol. I will leave a link to the complete reference in the extras section below. Also, these symbols are treated just like text, we can control the size using font-size , even apply font-weight and text-decoration on it.
METHOD 2) ICON IMAGES
2A) FLAT IMAGE ICON
So call me maybe?
So call me maybe?
This should be “Captain Obvious”, just insert an image icon. Do a search for “free icons” or “free clipart”, they are all over the Internet.
2B) IMAGE FONT SET
Following up on the above image icon method, it is inefficient to use one icon per image. This is the smarter way where we combine all the icons into one single image, but it requires a little bit of CSS to work.
.ico < display: inline-block; width: 32px; height: 30px; background-image: url('icon-set.png'); background-repeat: no-repeat; >.ico-screen < background-position: 0 0; >.ico-phone < background-position: -32px 0; >.ico-pc < background-position: -64px 0; >.ico-tablet < background-position: 0 -31px; >.ico-camera Screen Phone PC Tablet Camera
That’s right. All we are doing here is to use the icon set as the background image, then “map” them using background-position .
METHOD 3) ICON FONT SET
@font-face < font-family: Heydings; src: url(heydings_icons.ttf); >.icon
Fonts usually contain alphabets, but there are some interesting ones that are sets of icons instead – All we have to do is to find these sets of icons, include them using CSS @font-face , then use it just as usual.
I will leave links to free font websites in the extras section below, just do a font search for “icons”, and there will be plenty more. But please do take care that not all fonts are “fully free”… Some are free for personal use, but not for commercial use.
METHOD 4) ICON LIBRARIES
4A) FONT AWESOME
- Load the Font Awesome library from the CDN. There are a lot of versions… If unsure, just load all.min.css which contains everything.
- To insert an icon, use the tag, and give it a CSS class=»fa fa-ICON» – Check out the Font Awesome Gallery for the full list of available icons.
Of course, if you somehow need even more icons, there are also paid plans on Font Awesome.
4B) MATERIAL ICONS
Material Icons is another set of popular free icons, which you may find very familiar… Because it’s by Google. Check out their page on Google Fonts for the full list of icons.
EXTRA BITS & LINKS
That’s all for this tutorial, and here is a small section on some extras and links that may be useful to you.
WHICH IS THE BEST METHOD?
- I personally prefer HTML symbols when it comes to small projects, as it is the most lightweight option. But take note that some symbols will not show up properly on the older browsers, you will not want to use this if backward compatibility is an issue.
- Images are the safest and will always work, but they add to the loading time bloat.
- Font Awesome and Google Material Icons are also pretty safe options but they bloat the loading time as well.
- Loading fonts are kind of meh.
LINKS & REFERENCES
INFOGRAPHIC CHEAT SHEET
THE END
Thank you for reading, and we have come to the end of this guide. I hope that it has helped you with your project, and if you want to share anything with this guide, please feel free to comment below. Good luck and happy coding!
27 CSS Icons and Icon Sets
Collection of hand-picked free HTML and CSS icon and icon set examples from Codepen and other resources.
Related Articles
Table of Contents
Icon Sets
Author
Links
About a code
Tabler Icons
Free and open source icons designed to make your website or app attractive, visually consistent and simply beautiful.
Author
Links
About a code
css.gg
700+ CSS icons. Open-source CSS, SVG and Figma UI icons available in SVG sprite, styled-components, NPM & API.
Author
Links
About a code
Unicons
1000+ pixel-perfect vector icons and iconfont for your next project.
Author
Links
About a code
icons.css
Single element pure CSS icons. Elegantly developed pure CSS icons. Font size based single element icons. Production ready icons for your projects.
Author
Links
About a code
Font Awesome
The iconic SVG, font, and CSS toolkit.
Author
Links
About a code
iConicss
More than 900 pure CSS3 icons. Each icon uses a single anchor element (one div ) and just one color: the currentColor (and transparent) except for the colored icons (as the name suggests). Thus they can easily be included in a page with a single HTML element and use the current color and current font size.
Author
Links
About a code
Gov Icons
Free, open-sourced icon font and CSS toolkit with 136 government themed icons, for easy scalable vector graphics.