Files

57 lines
1.3 KiB
Plaintext

---
title: Webfont
description: Use Tabler Icons as a webfont and add any of the icons with a CSS class.
summary: The Tabler Icons webfont adds icons with a CSS class, with no build step and no inline SVG.
---
import TabsPackage from '@components/TabsPackage.astro'
import { Code } from 'astro:components'
import { site } from '@shared/lib/site.ts'
![Tabler Icons webfont](/img/icons/package-webfont.png)
## Installation
<TabsPackage name="@tabler/icons-webfont" />
or just [download from Github](https://github.com/tabler/tabler-icons/releases).
### CDN
Link the stylesheet directly from a CDN if you do not want to install the package:
<Code lang="html" code={`<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@${site.iconsVersion}/dist/tabler-icons.min.css"
/>`} />
Swap the version for `latest` to always pull the newest icons, or keep it pinned so the set stays stable.
## Usage
### HTML
Add an icon with an `<i>` element. Use the `ti` base class together with a `ti-` class that names the icon:
```html
<i class="ti ti-brand-tabler"></i>
```
### CSS
Set the icon's character code in the `content` property of a pseudo-element to show an icon from CSS:
```css
content: 'ec8f';
```
### SCSS
In SCSS, use the generated `$ti-icon-*` variables instead of raw character codes:
```scss
content: $ti-icon-brand-tabler;
```