2017 © Pedro Peláez
 

component flag-icon-css

image

components/flag-icon-css

  • Sunday, July 29, 2018
  • by lipis
  • Repository
  • 140 Watchers
  • 4946 Stars
  • 191,355 Installations
  • HTML
  • 13 Dependents
  • 0 Suggesters
  • 670 Forks
  • 47 Open issues
  • 39 Versions
  • 7 % Grown

The README.md

flag-icons

A curated collection of all country flags in SVG — plus the CSS for easier integration. See the demo., (*1)

Install

You can either download the whole project as is or install it via npm or Yarn:, (*2)

npm install flag-icons
# or
yarn add flag-icons

Usage

First, you need to import css:, (*3)

import "/node_modules/flag-icons/css/flag-icons.min.css";

or use CDN:, (*4)

<link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/gh/lipis/flag-icons@7.2.3/css/flag-icons.min.css"
/>

For using the flags inline with text add the classes .fi and .fi-xx (where xx is the ISO 3166-1-alpha-2 code of a country) to an empty <span>. If you want to have a squared version flag then add the class fis as well. Example:, (*5)

<span class="fi fi-gr"></span> <span class="fi fi-gr fis"></span>

You could also apply this to any element, but in that case you'll have to use the fib instead of fi and you're set. This will add the correct background with the following CSS properties:, (*6)

background-size: contain;
background-position: 50%;
background-repeat: no-repeat;

Which means that the flag is just going to appear in the middle of an element, so you will have to set manually the correct size of 4 by 3 ratio or if it's squared add also the flag-icon-squared class., (*7)

Development

Run the yarn to install the dependencies after cloning the project and you'll be able to:, (*8)

To build *.scss files, (*9)

$ yarn build

To serve it on localhost:8000, (*10)

$ yarn start

To have only specific countries in the css file, remove the ones that you don't need from the _flag-icons-list.scss file and build it again., (*11)

Credits

  • This project wouldn't exist without the awesome and now deleted collection of SVG flags by koppi.
  • Thank you Andrejs Abrickis for providing the flag-icons name on npm.

The Versions

29/07 2018

dev-gae

dev-gae

  Sources   Download

03/07 2018

dev-master

9999999-dev

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

13/06 2018

dev-dependabot/npm_and_yarn/grunt-contrib-less-2.0.0

dev-dependabot/npm_and_yarn/grunt-contrib-less-2.0.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

14/05 2018

dev-dependabot/npm_and_yarn/grunt-contrib-watch-1.1.0

dev-dependabot/npm_and_yarn/grunt-contrib-watch-1.1.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

01/03 2018

3.1.0

3.1.0.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

01/03 2018

dev-svgomin

dev-svgomin

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

22/02 2018

3.0.0

3.0.0.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

22/02 2018

dev-svgo

dev-svgo

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

29/01 2018

dev-tw

dev-tw

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

16/11 2017

2.9.0

2.9.0.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

27/07 2017

dev-greenkeeper/grunt-contrib-cssmin-2.2.1

dev-greenkeeper/grunt-contrib-cssmin-2.2.1

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

30/03 2017

dev-do

dev-do

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

11/12 2016

2.8.0

2.8.0.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

29/10 2016

2.7.0

2.7.0.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

03/10 2016

2.6.0

2.6.0.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

18/09 2016

2.5.0

2.5.0.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

14/08 2016

2.4.0

2.4.0.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

18/05 2016

2.3.1

2.3.1.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

18/05 2016

2.3.0

2.3.0.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

08/05 2016

2.2.0

2.2.0.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

26/04 2016

2.1.0

2.1.0.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

12/04 2016

2.0.0

2.0.0.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

06/03 2016

1.4.0

1.4.0.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

25/02 2016

1.3.0

1.3.0.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

13/02 2016

1.2.0

1.2.0.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

22/01 2016

1.1.0

1.1.0.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

26/12 2015

1.0.0

1.0.0.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

23/12 2015

0.8.6

0.8.6.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

15/11 2015

0.8.5

0.8.5.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

27/10 2015

0.8.4

0.8.4.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

26/10 2015

0.8.3

0.8.3.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

05/09 2015

0.8.2

0.8.2.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

05/09 2015

v0.8.1

0.8.1.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

04/09 2015

0.8.0

0.8.0.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

26/03 2015

0.7.1

0.7.1.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

02/03 2015

0.7.0

0.7.0.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

24/02 2015

0.6.5

0.6.5.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

13/10 2014

0.6.4

0.6.4.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)

16/06 2014

0.6.3

0.6.3.0

CSS for vector based country flags

  Sources   Download

MIT

by Panayiotis Lipiridis (Lipis)