- Html css javascript icons
- Available in
- Features
- Icons Tutorial
- Font Awesome 5 Icons
- Example
- Font Awesome 4 Icons
- Example
- Bootstrap 3 Icons
- Example
- Google Icons
- Example
- 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
- Варианты установки SVG иконки
- Установка графическим файлом
- Установка в HTML
- Установка через CSS
- Установка через JS
- Смотрите также:
Html css javascript icons
Open-source CSS, SVG and Figma UI Icons
Available in SVG Sprite, styled-components, NPM & API
Version: v2.0 — Total weight: 316kb
1 | .gg-play-list-check |
2 | box-sizing: border-box; |
3 | position: relative; |
4 | display: block; |
5 | transform: scale(var(—ggs, 1 )); |
6 | width: 12px ; |
7 | height: 6px ; |
8 | border-top: 0 solid transparent; |
9 | border-bottom: 2px solid transparent; |
10 | box-shadow: |
11 | inset 0 -2px 0 , |
12 | -2px 4px 0 -2px , |
13 | 0 -2px 0 0 |
14 | > |
15 | |
16 | .gg-play-list-check ::after |
17 | content: «»; |
18 | display: block; |
19 | box-sizing: border-box; |
20 | position: absolute; |
21 | width: 5px ; |
22 | height: 8px ; |
23 | border-right: 2px solid; |
24 | border-bottom: 2px solid; |
25 | transform: rotate( 45deg ); |
26 | top: 2px ; |
27 | right: -4px |
28 | > |
1 | .gg-expand |
2 | box-sizing: border-box; |
3 | position: relative; |
4 | display: block; |
5 | transform: scale(var(—ggs, 1 )); |
6 | width: 6px ; |
7 | height: 6px ; |
8 | border-bottom: 2px solid; |
9 | border-left: 2px solid |
10 | > |
11 | |
12 | .gg-expand ::after , |
13 | .gg-expand ::before |
14 | content: «»; |
15 | display: block; |
16 | box-sizing: border-box; |
17 | position: absolute; |
18 | > |
19 | |
20 | .gg-expand ::after |
21 | background: currentColor; |
22 | bottom: 4px ; |
23 | transform: rotate( -44deg ); |
24 | width: 14px ; |
25 | height: 2px ; |
26 | left: -2px |
27 | > |
28 | |
29 | .gg-expand ::before |
30 | width: 6px ; |
31 | height: 6px ; |
32 | border-top: 2px solid; |
33 | border-right: 2px solid; |
34 | left: 5px ; |
35 | top: -7px |
36 | > |
Available in
Features
700 Precise and Detailed UI Icons — provided with well-organized Figma components library.
Icons Tutorial
To insert an icon, add the name of the icon class to any inline HTML element.
The and elements are widely used to add icons.
All the icons in the icon libraries below, are scalable vector icons that can be customized with CSS (size, color, shadow, etc.)
Font Awesome 5 Icons
To use the Free Font Awesome 5 icons, go to fontawesome.com and sign in to get a code to use in your web pages.
Read more about how to get started with Font Awesome in our Font Awesome 5 chapter.
Note: No downloading or installation is required!
Example
Font Awesome 4 Icons
To use the Font Awesome 4 icons, add the following line inside the section of your HTML page:
Note: No downloading or installation is required!
Example
Bootstrap 3 Icons
To use the Bootstrap 3 glyphicons, add the following line inside the section of your HTML page:
Note: No downloading or installation is required!
Example
Note: Glyphicons are not supported in Bootstrap 4.
For more information about Bootstrap 3 and Glyphicons, visit our Bootstrap 3 Tutorial.
Google Icons
To use the Google icons, add the following line inside the section of your HTML page:
Note: No downloading or installation is required!
Example
cloud
favorite
attachment
computer
traffic
For a complete list of ALL icons (font awesome, bootstrap and google), visit the Icon Reference.
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.
Author
Варианты установки SVG иконки
Есть несколько методов установки SVG иконки на страницу, и у каждого есть свои плюсы и минусы.
У нас есть SVG иконка happyface.svg, которую нужно добавить на страницу.
Установка графическим файлом
Тут все просто, иконка ставится как обычная картинка в нужное место:
Это очень простой и удобный способ, но у нас появляется дополнительный файл. А если таких картинок на странице много, то и определенные неудобства
Установка в HTML
Можно вставить SVG графику непосредственно в нужное место HTML кода:
Установка через CSS
Можно сделать SVG графику фоновым изображением нужного элемента. Для этого переводим SVG код в CSS формат конвертером:
Размеры блока с бекграундом задаются через CSS, поэтому атрибуты width=’128′ и height=’128′ в SVG коде не нужны Получившийся результат вставляем в CSS нужного нам элемента, например:
background-image : url ( «data:image/svg+xml,%3Csvg role=’img’ xmlns=’http://www.w3.org/2000/svg’ viewBox=’0 0 24 24′ stroke=’%23337AB7′ stroke-width=’2′ stroke-linecap=’square’ stroke-linejoin=’miter’ fill=’none’ color=’%23337AB7’%3E %3Cpath d=’M7.3010863,14.0011479 C8.0734404,15.7578367 9.98813711,17 11.9995889,17 C14.0024928,17 15.913479,15.7546194 16.6925307,14.0055328’/%3E %3Cline stroke-linecap=’round’ x1=’9′ y1=’9′ x2=’9′ y2=’9’/%3E %3Cline stroke-linecap=’round’ x1=’15’ y1=’9′ x2=’15’ y2=’9’/%3E %3Ccircle cx=’12’ cy=’12’ r=’10’/%3E %3C/svg%3E» ) ;
Установка через JS
let svgimg = document . querySelectorAll ( «.happyface» ) ; // находим все элементы с классом happyface
- Опубликовано: 10.09.2019 / Обновлено: 21.02.2020
- Рубрики: Весь сайт, Картинки и иконки
- Метки: SVG, Иконки
- 16384 просмотра
Смотрите также:
Флаги стран мира на SVG
Иконки с флагами стран мира в SVG формате
Параллакс подвал
Интересный эффект появления футера сайта из под страницы
Снежный шар с котом
Снежный шар с котом внутри, реализованный на CSS и JS