@dzangolab/flag-icon-css

中文文档
3.4.5发布于 2019/12/17零依赖近 30 天下载 2126

A collection of all country flags in SVG — plus the CSS for easier integration. > See the demo.

原始使用文档
文档目录4 节
  1. Install
  2. Usage
  3. Development
  4. Credits

flag-icon-css

A collection of all country flags in SVG — plus the CSS for easier integration. See the demo.

Install

You can either download the whole project as is or install it via Bower or NPM:

$ bower install flag-icon-css
$ npm install flag-icon-css

Usage

For using the flags inline with text add the classes .flag-icon and .flag-icon-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 flag-icon-squared as well. If you want a rounded flag the add the class flag-icon-rounded as well. Example:

<span class="flag-icon flag-icon-gr"></span>
<span class="flag-icon flag-icon-gr flag-icon-squared"></span>
<span class="flag-icon flag-icon-gr flag-icon-rounded"></span>

You could also apply this to any element, but in that case you'll have to use the flag-icon-background instead of flag-icon and you're set. This will add the correct background with the following CSS properties:

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 (rounded) add also the flag-icon-squared (flag-icon-rounded) class.

Development

Run the npm install to install the dependencies after cloning the project and you'll be able to:

To watch for changes and live reload if served

$ grunt

To build *.less files

$ grunt build

To serve it on localhost:8000

$ grunt connect

To have only specific countries in the css file, remove the ones that you don't need from the flag-icon-list.less file and build it again.

Credits

This project is a fork of [lipis/flag-icon-css]((https://github.com/lipis/flag-icon-css). My ojly contribution is to add support for rounded flag icons. The author of the orignal package turned down our PR.

版本与发布记录

@dzangolab/flag-icon-css 共发布 1 个版本,首次发布于 2019/12/17;过去 12 个月发布了 0 个版本。

版本发布日期距今
3.4.5latest2019/12/176 年前

关于 @dzangolab/flag-icon-css 的常见问题

@dzangolab/flag-icon-css 是什么?

A collection of all country flags in SVG — plus the CSS for easier integration. > See the demo.

如何安装 @dzangolab/flag-icon-css?

在项目目录运行 npm install @dzangolab/flag-icon-css,或使用 pnpm add / yarn add / bun add。

@dzangolab/flag-icon-css 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/dzangolab__flag-icon-css 是否存在。

@dzangolab/flag-icon-css 可以商用吗?

@dzangolab/flag-icon-css 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@dzangolab/flag-icon-css 的下载量有多少?

根据 npm 官方下载统计,@dzangolab/flag-icon-css 在 2026/10/13 – 2026/11/11 这 30 天内被下载 2,126 次,日均约 71 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@dzangolab/flag-icon-css 还在维护吗?

最新版本 3.4.5 发布于 2019/12/17(6 年前);至今共发布 1 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/12/17。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。