HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
var regions = {
"AD": "安道爾",
"AE": "阿聯",
"AF": "阿富汗",
"AG": "安地卡及巴布達",
"AI": "安圭拉",
"AL": "阿爾巴尼亞",
"AM": "亞美尼亞",
"AO": "安哥拉",
"AQ": "南極洲",
"AR": "阿根廷",
"AS": "美屬薩摩亞",
"AT": "奧地利",
"AU": "澳大利亞",
"AW": "阿魯巴",
"AX": "奧蘭",
"AZ": "亞塞拜然",
"BA": "波士尼亞與赫塞哥維納",
"BB": "巴貝多",
"BD": "孟加拉",
"BE": "比利時",
"BF": "布吉納法索",
"BG": "保加利亞",
"BH": "巴林",
"BI": "蒲隆地",
"BJ": "貝南",
"BL": "聖巴瑟米",
"BM": "百慕達",
"BN": "汶萊",
"BO": "玻利維亞",
"BQ": "荷蘭加勒比區",
"BR": "巴西",
"BS": "巴哈馬",
"BT": "不丹",
"BV": "布韋島",
"BW": "波札那",
"BY": "白俄羅斯",
"BZ": "貝里斯",
"CA": "加拿大",
"CC": "科科斯(基林)群島",
"CD": "剛果民主共和國",
"CF": "中非",
"CG": "剛果共和國",
"CH": "瑞士",
"CI": "象牙海岸",
"CK": "庫克群島",
"CL": "智利",
"CM": "喀麥隆",
"CN": "中國",
"CO": "哥倫比亞",
"CR": "哥斯大黎加",
"CU": "古巴",
"CV": "維德角",
"CW": "古拉索",
"CX": "聖誕島",
"CY": "賽普勒斯",
"CZ": "捷克",
"DE": "德國",
"DJ": "吉布地",
"DK": "丹麥",
"DM": "多米尼克",
"DO": "多明尼加",
"DZ": "阿爾及利亞",
"EC": "厄瓜多",
"EE": "愛沙尼亞",
"EG": "埃及",
"EH": "西撒哈拉",
"ER": "厄利垂亞",
"ES": "西班牙",
"ET": "衣索比亞",
"FI": "芬蘭",
"FJ": "斐濟",
"FK": "福克蘭群島",
"FM": "密克羅尼西亞聯邦",
"FO": "法羅群島",
"FR": "法國",
"GA": "加彭",
"GB": "英國",
"GD": "格瑞那達",
"GE": "喬治亞",
"GF": "法屬圭亞那",
"GG": "根西",
"GH": "加納",
"GI": "直布羅陀",
"GL": "格陵蘭",
"GM": "甘比亞",
"GN": "幾內亞",
"GP": "瓜地洛普",
"GQ": "赤道幾內亞",
"GR": "希臘",
"GS": "南喬治亞和南桑威奇群島",
"GT": "瓜地馬拉",
"GU": "關島",
"GW": "幾內亞比索",
"GY": "蓋亞那",
"HK": "香港",
"HM": "赫德島和麥克唐納群島",
"HN": "宏都拉斯",
"HR": "克羅埃西亞",
"HT": "海地",
"HU": "匈牙利",
"ID": "印尼",
"IE": "愛爾蘭",
"IL": "以色列",
"IM": "曼島",
"IN": "印度",
"IO": "英屬印度洋領地",
"IQ": "伊拉克",
"IR": "伊朗",
"IS": "冰島",
"IT": "義大利",
"JE": "澤西",
"JM": "牙買加",
"JO": "約旦",
"JP": "日本",
"KE": "肯亞",
"KG": "吉爾吉斯",
"KH": "柬埔寨",
"KI": "吉里巴斯",
"KM": "葛摩",
"KN": "聖克里斯多福及尼維斯",
"KP": "北韓",
"KR": "南韓",
"KW": "科威特",
"KY": "開曼群島",
"KZ": "哈薩克",
"LA": "寮國",
"LB": "黎巴嫩",
"LC": "聖露西亞",
"LI": "列支敦斯登",
"LK": "斯里蘭卡",
"LR": "賴比瑞亞",
"LS": "賴索托",
"LT": "立陶宛",
"LU": "盧森堡",
"LV": "拉脫維亞",
"LY": "利比亞",
"MA": "摩洛哥",
"MC": "摩納哥",
"MD": "摩爾多瓦",
"ME": "蒙特內哥羅",
"MF": "法屬聖馬丁",
"MG": "馬達加斯加",
"MH": "馬紹爾群島",
"MK": "北馬其頓",
"ML": "馬利",
"MM": "緬甸",
"MN": "蒙古",
"MO": "澳門",
"MP": "北馬利安納群島",
"MQ": "馬丁尼克",
"MR": "茅利塔尼亞",
"MS": "蒙特塞拉特",
"MT": "馬爾他",
"MU": "模里西斯",
"MV": "馬爾地夫",
"MW": "馬拉威",
"MX": "墨西哥",
"MY": "馬來西亞",
"MZ": "莫三比克",
"NA": "納米比亞",
"NC": "新喀里多尼亞",
"NE": "尼日",
"NF": "諾福克島",
"NG": "奈及利亞",
"NI": "尼加拉瓜",
"NL": "荷蘭",
"NO": "挪威",
"NP": "尼泊爾",
"NR": "諾魯",
"NU": "紐埃",
"NZ": "紐西蘭",
"OM": "阿曼",
"PA": "巴拿馬",
"PE": "秘魯",
"PF": "法屬玻里尼西亞",
"PG": "巴布亞紐幾內亞",
"PH": "菲律賓",
"PK": "巴基斯坦",
"PL": "波蘭",
"PM": "聖皮埃與密克隆群島",
"PN": "皮特凱恩群島",
"PR": "波多黎各",
"PS": "巴勒斯坦",
"PT": "葡萄牙",
"PW": "帛琉",
"PY": "巴拉圭",
"QA": "卡達",
"RE": "留尼旺",
"RO": "羅馬尼亞",
"RS": "塞爾維亞",
"RU": "俄羅斯",
"RW": "盧安達",
"SA": "沙烏地阿拉伯",
"SB": "索羅門群島",
"SC": "塞席爾",
"SD": "蘇丹",
"SE": "瑞典",
"SG": "新加坡",
"SH": "聖赫倫那、阿森松和特里斯坦-達庫尼亞",
"SI": "斯洛維尼亞",
"SJ": "斯瓦爾巴和揚馬延",
"SK": "斯洛伐克",
"SL": "獅子山",
"SM": "聖馬利諾",
"SN": "塞內加爾",
"SO": "索馬利亞",
"SR": "蘇利南",
"SS": "南蘇丹",
"ST": "聖多美普林西比",
"SV": "薩爾瓦多",
"SX": "荷屬聖馬丁",
"SY": "敘利亞",
"SZ": "史瓦帝尼",
"TC": "特克斯與凱科斯群島",
"TD": "查德",
"TF": "法屬南部和南極領地",
"TG": "多哥",
"TH": "泰國",
"TJ": "塔吉克",
"TK": "托克勞",
"TL": "東帝汶",
"TM": "土庫曼",
"TN": "突尼西亞",
"TO": "東加",
"TR": "土耳其",
"TT": "千里達及托巴哥",
"TV": "吐瓦魯",
"TW": "臺灣",
"TZ": "坦尚尼亞",
"UA": "烏克蘭",
"UG": "烏干達",
"UM": "美國本土外小島嶼",
"US": "美國",
"UY": "烏拉圭",
"UZ": "烏茲別克",
"VA": "梵蒂岡",
"VC": "聖文森及格瑞那丁",
"VE": "委內瑞拉",
"VG": "英屬維京群島",
"VI": "美屬維京群島",
"VN": "越南",
"VU": "萬那杜",
"WF": "瓦利斯和富圖那",
"WS": "薩摩亞",
"YE": "葉門",
"YT": "馬約特",
"ZA": "南非",
"ZM": "尚比亞",
"ZW": "辛巴威"
};
var i = 0;
for(var regionCode in regions) {
document.write(regions[regionCode] + "<br>");
i++;
}
document.write("<hr>" + i + " regions");
Also see: Tab Triggers