Font awesome and css

Get Started

Font Awesome CDN is the easiest way to get Font Awesome on your website or app, all with just a single line of code. No downloading or installing!

We create new embed codes for each website so you can quickly upgrade and change your preferences all without ever pushing code. To do this, we need an email address so we know which embed codes are yours and so you can come back and manage them.

Icons on your site. Fast.

Don’t mess with files locally or in production. You’ll get all of Font Awesome’s 675 icons plus CSS toolkit — all optimized for speed and no hassle.

Super-simple upgrades

Since each site gets a unique embed code, you can easily upgrade to the latest version of Font Awesome, all without pushing any code. Easy peasy.

Читайте также:  Html css column class

Auto accessibility support

Font Awesome CDN helps you automate accessibility support more easily so your icons work for the most people possible. Read up on our accessibility best practices.

Async your icons

Want to speed up your page loads? So do we. Have your icons load in the background so your site loads faster.

Download & Customize Easy

Want to manage and host Font Awesome assets yourself? You can download, customize, and use the icons and default styling manually. Both CSS and CSS Preprocessor (Sass and Less) formats are included.

Using CSS

  1. Copy the entire font-awesome directory into your project.
  2. In the of your html, reference the location to your font-awesome.min.css.
 rel="stylesheet" href="path/to/font-awesome/css/font-awesome.min.css"> 

Using Sass or Less

Use this method to customize Font Awesome 4.7.0 using Less or Sass.

  1. Copy the font-awesome/ directory into your project.
  2. Open your project’s font-awesome/less/variables.less or font-awesome/scss/_variables.scss and edit the @fa-font-path or $fa-font-path variable to point to your font directory.

Advanced & Packages Pro

Less Ruby Gem

Use the Official Font Awesome Less Ruby Gem to easily get Font Awesome Less into a Rails project. Generously maintained by @supercodepoet.

    Add this line to your application’s Gemfile:

$ gem install font-awesome-less 

If you use Rails, add this to your e.g. application.less :

@import "font-awesome-sprockets"; @import "font-awesome"; 

Sass Ruby Gem

Use the Official Font Awesome Sass Ruby Gem to easily get Font Awesome Sass into a Rails or Compass project. Generously maintained by @supercodepoet.

    Add this line to your application’s Gemfile:

$ gem install font-awesome-sass 

If you use Rails, add this to your e.g. application.scss :

@import "font-awesome-sprockets"; @import "font-awesome"; 

More Information

Validators

In order to provide the best possible experience to old and buggy browsers, Font Awesome uses CSS browser hacks in several places to target special CSS to certain browser versions in order to work around bugs in the browsers themselves. These hacks understandably cause CSS validators to complain that they are invalid. In a couple places, we also use bleeding-edge CSS features that aren’t yet fully standardized, but these are used purely for progressive enhancement.

These validation warnings don’t matter in practice since the non-hacky portion of our CSS does fully validate and the hacky portions don’t interfere with the proper functioning of the non-hacky portion, hence why we deliberately ignore these particular warnings.

Internet Explorer 8 and @font-face

IE8 has some issues with @font-face when combined with :before . Font Awesome uses that combination. If a page is cached, and loaded without the mouse over the window (i.e. hit the refresh button or load something in an iframe) then the page gets rendered before the font loads. Hovering over the page (body) will show some of the icons and hovering over the remaining icons will show those as well. See issue #954 for details.

Need IE7 Support?

If you need IE7 support, you have my condolences. Really. Font Awesome 4.7.0 doesn’t support IE7, but an older version does. You’ll need to check out the 3.2.1 instructions for using IE7. Then go complain to whoever decided your project needs IE7 support.

Troubleshooting

If you’re having trouble with Font Awesome, make sure to check out the troubleshooting wiki page. Generously maintained by @gtagliala.

Источник

Примеры

После того, как вы подключили Font Awesome к своему проекту, иконки можно вызывать с помощью тега . Некоторые примеры были позаимствованы из документации Bootstrap.

The following examples are kept simple and assume use of Font Awesome CDN, which provides auto-accessibility support. If you are not using the Font Awesome CDN, please see the manual accessibility examples and read more about making your icons more awesome for all users

Базовые иконки

Пример: Базовые иконки fa-camera-retro

Вы можете разместить иконки Font Awesome в любом месте, используя в имени класса префикс fa и название иконки. Font Awesome разработан так, чтобы он мог быть использован в строковых элементах (мы любим использовать тег так как он очень короткий, но использование тега будет семантически более правильно).

 class="fa fa-camera-retro"> fa-camera-retro 
  • Пример: Базовые иконки Если вы меняете значение свойства font-size у контейнера иконок, то иконки станут больше. Такое поведение происходит и с цветом, тенью и другими свойствами, которые могут наследоваться.

Увеличенные иконки

Для увеличения размеров иконок в родительском элементе используйте классы fa-lg (увеличение на 33%), fa-2x , fa-3x , fa-4x , или fa-5x .

 class="fa fa-camera-retro fa-lg"> fa-lg  class="fa fa-camera-retro fa-2x"> fa-2x  class="fa fa-camera-retro fa-3x"> fa-3x  class="fa fa-camera-retro fa-4x"> fa-4x  class="fa fa-camera-retro fa-5x"> fa-5x 
  • Если ваши иконки обрезаны сверху и снизу, то удостоверьтесь в правильном значении свойства line-height.

Иконки с фиксированной шириной

Используйте класс fa-fw для того, чтобы задать фиксированную ширину иконкам. Прекрасно подходит для тех случаев, когда различная ширина иконок мешает правильному выравниванию. Особенно полезно при использовании иконок в навигации и списках групп.

 class="list-group">  class="list-group-item" href="#"> class="fa fa-home fa-fw" aria-hidden="true">  Главная  class="list-group-item" href="#"> class="fa fa-book fa-fw" aria-hidden="true">  Библиотека  class="list-group-item" href="#"> class="fa fa-pencil fa-fw" aria-hidden="true">  Приложения  class="list-group-item" href="#"> class="fa fa-cog fa-fw" aria-hidden="true">  Настройки  

Иконки списков

Используйте классы fa-ul и fa-li для быстрого удаления стандартных маркеров в ненумерованных списках.

Обрамленные и вынесенные иконки

…Душа моя озарена неземной радостью, как эти чудесные весенние утра, которыми я наслаждаюсь от всего сердца… Я совсем один и блаженствую в здешнем краю, словно созданном для таких, как я.

Используйте классы fa-border и fa-pull-right или fa-pull-left для выделения цитаты или подключения иконки статьи.

 class="fa fa-quote-left fa-3x fa-pull-left fa-border" aria-hidden="true"> . Душа моя озарена неземной радостью, как эти чудесные весенние утра, которыми я наслаждаюсь от всего сердца. Я совсем один и блаженствую в здешнем краю, словно созданном для таких, как я. 

Анимированные иконки

Пример загрузки (с fa-spinner icon) Пример загрузки (с fa-circle-o-notch icon) Пример загрузки (с fa-refresh icon) Пример загрузки (с fa-cog icon) Пример загрузки (с fa-spinner icon)

Используйте класс fa-spin , чтобы заставить вращаться любую иконку, и используйте класс fa-pulse , чтобы заставить вращаться иконку по 8 шагов. Также работает с классами fa-spinner , fa-refresh , и fa-cog .

 class="fa fa-spinner fa-spin fa-3x fa-fw">  class="sr-only">Загрузка.  class="fa fa-circle-o-notch fa-spin fa-3x fa-fw">  class="sr-only">Загрузка.  class="fa fa-refresh fa-spin fa-3x fa-fw">  class="sr-only">Загрузка.  class="fa fa-cog fa-spin fa-3x fa-fw">  class="sr-only">Загрузка.  class="fa fa-spinner fa-pulse fa-3x fa-fw">  class="sr-only">Загрузка. 

На заметку: Некоторые браузера на нескольких платформах имеют проблемы с анимацией иконок, что дает эффект «безудержного веселья» у иконки. Читайте проблему #671 для ознакомления с ней и изучения возможных решений.

На заметку: Анимация CSS3 не поддерживается в IE8 — IE9.

Повернутые и отзеркаленные иконки

normal
fa-rotate-90
fa-rotate-180
fa-rotate-270
fa-flip-horizontal
fa-flip-vertical

Чтобы произвольно поворачивать и зеркалить иконки, используйте классы fa-rotate-* and fa-flip-* .

 class="fa fa-shield"> normal  class="fa fa-shield fa-rotate-90"> fa-rotate-90  class="fa fa-shield fa-rotate-180"> fa-rotate-180  class="fa fa-shield fa-rotate-270"> fa-rotate-270  class="fa fa-shield fa-flip-horizontal"> fa-flip-horizontal  class="fa fa-shield fa-flip-vertical"> fa-flip-vertical 

Групповые иконки

Чтобы сделать группу из иконок, используйте класс fa-stack для родителя, класс fa-stack-1x используйте для задания стандартного размера иконки, а класс fa-stack-2x для увеличенного. Класс fa-inverse может быть использован для присваивания альтернативного цвета иконке. Также вы можете использовать классы увеличения для управления размерами иконок.

 class="fa-stack fa-lg">  class="fa fa-square-o fa-stack-2x">  class="fa fa-twitter fa-stack-1x">  fa-twitter на fa-square-o  class="fa-stack fa-lg">  class="fa fa-circle fa-stack-2x">  class="fa fa-flag fa-stack-1x fa-inverse">  fa-flag на fa-circle  class="fa-stack fa-lg">  class="fa fa-square fa-stack-2x">  class="fa fa-terminal fa-stack-1x fa-inverse">  fa-terminal на fa-square  class="fa-stack fa-lg">  class="fa fa-camera fa-stack-1x">  class="fa fa-ban fa-stack-2x text-danger">  fa-ban на fa-camera 

Примеры для Bootstrap 3

Font Awesome прекрасно работает со всеми компонентами Bootstrap.

Пользовательский CSS

Всё, что вы можете сделать со шрифтами с помощью CSS, вы сможете сделать и с Font Awesome.

Пример рейтинга (позаимствовано из CSS Tricks)

Общедоступность

Обновление. Сохранение. Держитесь крепче!

Немного о наших мыслях об общедоступности иконок. Если иконка используется для декорирования или отображения бренда, то они не должны быть объявлены общедоступно, тк они влияют на приложения, читающие сайты в слух. Если иконка передает смысл содержания текста в контексте интерфейса, то убедитесь в том, что этот смысл также передается и вспомогательными технологиями, дополнительным текстом или скрытым блоком.

 class="btn btn-default" href="path/to/settings" aria-label="Настройки">  class="fa fa-cog" aria-hidden="true">   class="btn btn-danger" href="path/to/settings" aria-label="Удалить">  class="fa fa-trash-o" aria-hidden="true">   class="btn btn-primary" href="#navigation-main" aria-label="Перейти к основному меню">  class="fa fa-bars" aria-hidden="true">  
 class="fa fa-refresh fa-spin fa-3x fa-fw" aria-hidden="true">  class="sr-only">Обновление.  class="fa fa-cog fa-spin fa-3x fa-fw" aria-hidden="true">  class="sr-only">Сохранение. Держитесь крепче! 
 class="input-group margin-bottom-sm">  class="input-group-addon"> class="fa fa-envelope-o fa-fw" aria-hidden="true">  class="form-control" type="text" placeholder="Ваш email">   class="input-group">  class="input-group-addon"> class="fa fa-key fa-fw" aria-hidden="true">  class="form-control" type="password" placeholder="Пароль">  
 href="path/to/shopping/cart" class="btn btn-primary" aria-label="Посмотреть 3 предмета в вашей корзине">  class="fa fa-shopping-cart" aria-hidden="true">  
 class="fa fa-battery-half" aria-hidden="true">  class="sr-only">Уровень заряда: 50% 

Font Awesome предоставляется по лицензии SIL OFL 1.1 ·
Разработка предоставляется по лицензии MIT License ·
Документация предоставляется по лицензии CC BY 3.0

Источник

Use Font Awesome on the Web

Get set up, add icons and style, or fine-tune – we’ve got what you need to know to use Font Awesome icons on the web.

Remove ads with a Pro plan!

A subscription to a Pro-level plan will remove all third-party advertisements on fontawesome.com.

And of course Pro-level plans come with…

Get Font Awesome Pro for only $99/yr

Setting Up on the Web

There are a few different ways to set up Font Awesome. We suggest using a kit since it’s easy, fast, and customizable.

Use a Kit

Like a CDN just for you! Adjust the settings, get auto-subsetting, upload your own icons, and lots more goodies.

In a Hurry? Try Our Quick Start.

Create a kit, add some icons, sprinkle in some style, and you’re off and running!

Host Yourself

Take the wheel and drive how you want when you host yourself.

Upgrade from Earlier Versions of Font Awesome

Are you a Font Awesome OG using Version 5, or even 4? You can easily upgrade to Version 6.

Use Font Awesome npm Packages

Get all the awesome packed up to-go in our npm packages.

Add Font Awesome Icons to Your Project

Remove ads with a Pro plan!

A subscription to a Pro-level plan will remove all third-party advertisements on fontawesome.com.

And of course Pro-level plans come with…

Get Font Awesome Pro for only $99/yr

You can add icons to your web projects with a little bit of code — it’s easy once you have a few of the basics under your belt.

Источник

Оцените статью