Phoca CSS Flags is a CSS library which renders world flags with help of CSS file only. No images are used for rendering the flags.
Using this method (rendering flags only by CSS) has pros and cons. It always depends on how or where such method will be used.
Displaying the flags is based on SVG feature. SVG is XML-based vector image format (see more information: Scalable Vector Graphics). CSS doesn't include a link to the SVG file but it directly includes its source code and renders it as background image.
For example, your site renders list of 50 language flags. Then you just need to load one CSS, where the language codes and their attributes are defined.
Of course, you always have to think about it. If it is reasonable to display flags this way. In case you are displaying one or two flags on your site, it doesn't make any sense to load 4 MB CSS file which includes all world flags definitions. But, as written above, most of the large size flags don't need to be included in some cases.
For example:
While making a list of languages you don't need to include Saint-Pierre a Miquelon flag (it is a graphically complex flag and its size is too large) because French is spoken in this self-governing territorial. Including French flag in CSS is sufficient. There are a lot of large size flags which don't need to be included.
This applies to national and civil flags too.
There are different SVG files for each flag. In case, you need to reduce the size of CSS file, you can include version of the flag with simplified code, so the final size of CSS will be smaller.
The following CSS code is responsible for rendering the German flag on the site:
/* germany */
.de {
background:url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBoZWlnaHQ9IjYwMCIgdmlld0JveD0iMCAwIDUgMyI+DQo8cGF0aCBkPSJtMCwwaDV2M2gtNXoiLz4NCjxwYXRoIGZpbGw9IiNkMDAiIGQ9Im0wLDFoNXYyaC01eiIvPg0KPHBhdGggZmlsbD0iI2ZmY2UwMCIgZD0ibTAsMmg1djFoLTV6Ii8+DQo8L3N2Zz4NCg==');
width: 100%;
height: 60%;
background-size: 100% 100%;
}
Of course, you can add your specific SVG icons and extend the class.
CSS in download package includes following flags:
Andorra (ad), United Arab Emirates (ae), Afghanistan (af), Antigua And Barbuda (ag), Anguilla (ai), Albania (al), Armenia (am), Netherlands Antilles (an), Angola (ao), Argentina (ar), American Samoa (as), Austria (at), Australia (au), Aruba (aw), Aaland (ax), Azerbaijan (az), Bosnia And Herzegovina (ba), Basque (basque), Barbados (bb), Bangladesh (bd), Belgium (be), Burkina Faso (bf), Bulgaria (bg), Bahrain (bh), Burundi (bi), Benin (bj), Bermuda (bm), Brunei (bn), Bolivia (bo), Brazil (br), Bahamas (bs), Bhutan (bt), Bouvet Island (bv), Botswana (bw), Belarus (by), Belize (bz), Canada (ca), Catalonia (catalonia), Cocos Islands (cc), Democratic Republic Of Congo (cd), Central African Republic (cf), Congo (cg), Switzerland (ch), Cote D\'ivoire (ci), Cook Islands (ck), Chile (cl), Cameroon (cm), China (cn), Colombia (co), Costa Rica (cr), Serbia And Montenegro (cs), Cuba (cu), Cape Verde (cv), Christmas Island (cx), Cyprus (cy), Czech Republic (cz), Germany (de), Djibouti (dj), Denmark (dk), Dominica (dm), Dominican Republic (do), Algeria (dz), Ecuador (ec), Estonia (ee), Egypt (eg), Western Sahara (eh), England (england), Eritrea (er), Spain (es), Ethiopia (et), Europe (eu), Finland (fi), Fiji (fj), Falkland Islands (fk), Federated States Of Micronesia (fm), Faroe Islands (fo), France (fr), Gabon (ga), Galicia (galicia), United Kingdom (gb), Grenada (gd), Georgia (ge), French Guiana (gf), Guernsey (gg), Ghana (gh), Gibraltar (gi), Greenland (gl), Gambia (gm), Guinea (gn), Guadeloupe (gp), Equatorial Guinea (gq), Greece (gr), South Georgia And South Sandwich Islands (gs), Guatemala (gt), Guam (gu), Guinea-bissau (gw), Guyana (gy), Hong Kong (hk), Heard Island And Mcdonald Slands (hm), Honduras (hn), Croatia (hr), Haiti (ht), Hungary (hu), Indonesia (id), Ireland (ie), Israel (il), Isle Of Man (im), India (in), British Indian Ocean Territory (io), Iraq (iq), Iran (ir), Iceland (is), Italy (it), Jersey (je), Jamaica (jm), Jordan (jo), Japan (jp), Kenya (ke), Kyrgyzstan (kg), Cambodia (kh), Kiribati (ki), Comoros (km), Saint Kitts And Nevis (kn), North Korea (kp), South Korea (kr), Kuwait (kw), Cayman Islands (ky), Kazakhstan (kz), Laos (la), Lebanon (lb), Saint Lucia (lc), Liechtenstein (li), Sri Lanka (lk), Liberia (lr), Lesotho (ls), Lithuania (lt), Luxembourg (lu), Latvia (lv), Libya (ly), Morocco (ma), Monaco (mc), Moldova (md), Montenegro (me), Saint Martin (mf), Madagascar (mg), Marshall Islands (mh), Macedonia (mk), Mali (ml), Myanmar (mm), Mongolia (mn), Macau (mo), Northern Mariana Islands (mp), Martinique (mq), Mauritania (mr), Montserrat (ms), Malta (mt), Mauritius (mu), Maldives (mv), Malawi (mw), Mexico (mx), Malaysia (my), Mozambique (mz), Namibia (na), New Caledonia (nc), Niger (ne), Norfolk Island (nf), Nigeria (ng), Nicaragua (ni), Netherlands (nl), Norway (no), Nepal (np), Nauru (nr), Niue (nu), New Zealand (nz), Oman (om), Panama (pa), Peru (pe), French Polynesia (pf), Papua New Guinea (pg), Philippines (ph), Pakistan (pk), Poland (pl), Saint-pierre And Miquelon (pm), Pitcairn Islands (pn), Puerto Rico (pr), Palestine (ps), Portugal (pt), Palau (pw), Paraguay (py), Qatar (qa), Reunion (re), Romania (ro), Serbia (rs), Russia (ru), Rwanda (rw), Saudi Arabia (sa), Solomon Islands (sb), Seychelles (sc), Scotland (scotland), Sudan (sd), Sweden (se), Singapore (sg), Saint Helena (sh), Slovenia (si), Svalbard And Jan Mayen (sj), Slovakia (sk), Sierra Leone (sl), San Marino (sm), Senegal (sn), Somalia (so), Suriname (sr), Sao Tome And Principe (st), El Salvador (sv), Syria (sy), Swaziland (sz), Turks And Caicos Islands (tc), Chad (td), French Southern And Antarctic Lands (tf), Togo (tg), Thailand (th), Tajikistan (tj), Tokelau (tk), East Timor (tm), Turkmenistan (tm), Tunisia (tn), Tonga (to), Turkey (tr), Trinidad And Tobago (tt), Tuvalu (tv), Republic Of China Taiwan (tw), Tanzania (tz), Ukraine (ua), Uganda (ug), United States Minor Outlying Islands (um), United States (us), Uruguay (uy), Uzbekistan (uz), Vatican City (va), Saint Vincent And Grenadines (vc), Venezuela (ve), British Virgin Islands (vg), United States Virgin Islands (vi), Vietnam (vn), Vanuatu (vu), Wales (wales), Wallis And Futuna (wf), Samoa (ws), Yemen (ye), Mayotte (yt), South Africa (za), Zambia (zm), Zimbabwe (zw)
If you have any question, if you have any idea or improvement or you just found some bug, please go to Phoca Forum and make a post there. Thank you.