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.
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 1386 822" id="canada-map">
<g id="Alberta">
<title>Alberta</title>
<desc>
<image xlink:href="moraine_lake.jpg" alt="A lake surrounded by mountains"></image>
<p>One of Canada's four prairie provinces, and the most populous of them, Alberta is the only one to border a single US state. It is divided from British Columbia by the Rocky Mountains, over which run gusts of wind, known as <i>chinooks</i>, that can keep the southern part of the province considerably warmer than its eastern neighbours during the winter.</p>
</desc>
<path d="M435.3,670.2c-13.1-1.1-44.7,3.1-53.5-9.8c-6.3-8.1-2.5-17.6-3.8-27.3c-1.8-13.2-18-29.8-25.5-40.5 c-6.7-9.5-16.4-18.5-21.8-28.8c-4.8-9.1-20.5-25.4-20.6-33.4c-0.1-8.2,0.2-15.6,1.4-23.9c3.9-25.8,8.5-51.5,12.9-77.2
c3.5-20.3,7-40.5,10.5-60.8c2.1-12.1,10.5-6.2,21.5-4.6c36.5,5.3,73.3,8.3,109.8,13c9.7,1.3-5.2,20.4-6.9,22.6
c-1.4,1.8-9.1,10.2-5.5,12.1c5.3,2.8,15.1-5.1,12.6-6.8c3.3,2.3-1.2,29.4-1.5,34c-1,17.7-2.1,35.4-3.1,53.1 c-2,34.5-4.1,69-6.1,103.5c-1.4,23.5-2.4,47-4.1,70.5C450.8,675.9,446.1,671.1,435.3,670.2C380.2,665.7,443.3,670.9,435.3,670.2z" />
</g>
<g id="British_Columbia">
<title>British Columbia</title>
<desc>
<image xlink:href="bc-coast.jpg" alt="Photograph of a forested coastline, with mountains beyond"></image>
<p>One of the western-most of Canada’s provinces, British Columbia is part of the Cascadia region, bounded by the Pacific Ocean on the west and the Rocky Mountains to the east. The environment ranges from temperate rain forest in the southern coastal regions to extremely cold in the north.</p>
</desc>
<path d="M217,656.1c-10.6-4.4-13.4-13.4-20.5-20.3c-6.5-6.4-11.8-12.3-17.7-20.2c-6-8-14.1-16.4-17.8-25.7 c-1.7-4.2-8.5-24.1,4.3-16.8c15.8,8.9,36.6,24.1,42,42.3C208.6,619.9,247.7,668.7,217,656.1C210,653.2,220.6,657.5,217,656.1z"/>
<path d="M379.6,665.3c-22.1-2.4-43.9-5.6-65.8-9.6c-15-2.7-30-5.5-44.9-8.3c-6.9-1.3-33.5-2.5-36.4-8.8 c-4.9-10.4-14.3-13.5-20.6-22.4c-4.4-6.1-5.3-12.9-11.1-18.3c-8-7.6-8.1-7.6-11.7-16.9c-2.4-6.2-14.4-3.8-16.6-14.3
c-1.2-5.8-3.3-12.8-2.8-18.7c0.6-6.4,4.1-5.7,1.6-13c-2.4-7-16.4-18.6-10-26.3c1.4-1.7-9.3-31.6-9.7-36.3
c-1.1-11.9,21.1-13.1,18.9-25.3c-1.7-9.7,13.2-23.9,0.4-31.8c-12.1-7.5-16.5-21.2-15.8-34.4c0.8-13.8-3.5-30-8.7-42.8
c-3.7-9.1-8.6-35.8-19.2-38.1c-12.8-2.9-16.8,14.7-29.4,16.9c4.4-0.8-5.7-23.4-6.6-25.8c-6.7-18.4,25,1.4,31.5,4.1
c32.7,13.8,65.7,25.9,99.3,37.2c21.8,7.3,43.9,14,66.4,19c5.8,1.3,45.3,5.9,43.9,12.1c-3.6,15.8-5.6,32.1-8.3,48.1
c-5.3,31.1-11.2,62-16,93.2c-2.2,14.3-5.6,29.5,5.8,38.8c5,4.1,9.8,10.4,11.6,16.7c1.5,5.3,8.1,9.5,8.9,14.3
c1.2,6.5,13.8,16.9,17.6,23c6.3,10.2,20.5,23.3,22.6,34.9C375.7,638.2,374.6,664.8,379.6,665.3 C378.7,665.2,381.4,665.5,379.6,665.3z"/>
<path d="M120.8,519.8c-6.5-9.8-24.2-68.1,1-53.5c13.7,7.9,5.2,12.8-1.8,24.2c-3.8,6.2,3.6,34.4,5.7,33.8
C123.4,523.6,121.8,522.1,120.8,519.8C115.1,511.3,123.9,524.5,120.8,519.8z"/>
</g>
<g id="Manitoba">
<title>Manitoba</title>
<desc>
<image xlink:href="manitoba.jpg" alt=""></image>
<p>Manitoba is sparsely populated, especially in the north, which is dominated by arctic tundra and the Canadian Shield, a vast area of igneous rock that forms the ancient geological core of the North American continent.</p>
</desc>
<path d="M580,378.1c0.8,12,1.1,24.1,1.6,36.1c0.2,6.2-1.4,17.1,3,22.3c2.9,3.3-3.3,14.8-2.9,20.3
c3.2,40.2,9.2,80.2,12.8,120.4c2.8,30.9,5.3,62.3,10.5,92.9c1,5.8,87.6-5.5,97-6.9c5.6-0.8-10.9-85.8-9-95.8
c3.3-17,21-34.7,30.1-49.6c10.1-16.7,19.9-33.6,30.2-50.2c3.9-6.3,7.7-12.6,11.7-18.9c7.3-11.5-2.3-9.1-11.9-9.7
c-4.2-0.3-16-6.1-18.8,0.5c-1.1,2.5-16.1,7-15.2,1.9c1.2-6.9-9.8-37.5-17.4-39.9c-6-1.9-18.7,1.8-21-5.9 c-2.4-7.9-2.4-16.6-2.8-24.8C646,376.4,612.1,376.5,580,378.1z M638.3,542.3c11-1.9,18.2,16.5,21.5,23.9
c5.7,13,12.5,25.6,18.4,38.5c1.3,2.8,6.5,16.4,3.6,19c-2.5,2.2-7.6,8.3-10.8,6.1c-4.3-3-1.4-18.1,0.7-21.7
c5.8-10.2-5.3-2.7-6.3-2.3c-2.4,1-1.4-10.7-1.3-10.7c-2.7-10.2-9.8-1.2-14.8-5c-6.4-5-14.4-31-25.7-24.3
c-5.5,3.2,0.1,27.6,5.9,30.7c13.3,7.2,17.9,21.2,23.5,34.7c1.4,3.3-1.9,12-6.1,7.2c-4.9-5.5-7.2-16.7-9.6-23.4
c-3-8.2-9.7-9.2-16.7-13.2c-6.8-3.9-2.9-7.7-3-13.8c-0.2-10.3-2.6-10.2-9.7-15c-9-6,0.8-6.9,1.7-11.1c0.4-2.1-8.2-17.7,5.6-10.9 c4.7,2.3,6.7,7.2,11.1,9.9C627.4,553.3,629.4,543.8,638.3,542.3z"/>
</g>
<g id="New_Brunswick">
<title>New Brunswick</title>
<desc>
<image xlink:href="east-quoddy-lighthouse.jpg" alt="White lighthouse decorated with a red cross photographed in front of a fog bank"></image>
<p>One of Canada’s three Maritime provinces, bordering the Atlantic ocean. It is the only constitutionally bi-lingual province (French-English), partly due to the presence of the large Acadian population, most of whom are descended from returnees from the mass expulsion of the Acadian people by the British during the French-Indian war.</p>
</desc>
<path d="M1208.9,621.9c-2.9-0.2-13.9-9.4-16.3-12.4c-5.8-6.8-7.4-23.5-14-27.8c-7-4.6-15.7-0.7-17.5-8.1
c-3.2-13.1,3.5-7.9,13.3-13.2c8.4-4.5,15-16.6,26.2-14c2.4,0.5,19.6-12.7,20.1-8.9c0.6,3.9-1.7,7.6-0.8,11.9c1,5.1,4.8,7.4,6.6,12
c6,14.5,17.3,3.4,24.7,8.6c0,0-13.4,28.1-15,30.4C1231.1,608.4,1218.8,622.6,1208.9,621.9C1206.6,621.7,1215.4,622.4,1208.9,621.9z"/>
</g>
<g id="Newfoundland_and_Labrador">
<title>Newfoundland & Labrador</title>
<desc>
<image xlink:href="bay-bulls-newfoundland.jpg" alt="Scattered houses on a bluff above the ocean"></image>
<p>A unique province that consists of both an island (Newfoundland) and a portion of the mainland (Labrador). The area has a deep history, being inhabited by the Beothuk, Inuit, Mi'kmaq and Innu for thousands of years. European content began in 1001 CE, when the area was temporarily settled by Vikings led by Leif Ericson.</p>
</desc>
<path d="M1299.5,494.2c-7.4-6.6,2.1-12.9-0.9-20c-1.4-1.2-2.9-2.5-4.3-3.7c-0.6-4,2.5-7.4,1.8-11.6c-3.6-20.8-7.7-40.8-9.4-61.9
c-0.7-9.3,11.8-34.6,17.5-15.9c3.7,11.9,2.8,24.3,3.8,36.5c3.7-9,18-14.8,16.2-0.3c7.6-0.7,13.2-4.4,19.6-8.2
c5.7-3.3,10.8-7.7,17.9-5.5c5.3,1.6,1.8,7.6,2.9,10.5c3.2,8.1,21.4-7.3,16.1,7.8c-0.5,1.5-6.3,16.4,1.4,16.4
c1.5,0,3.1-13.7,7.3-9.2c1.3,2.2,2.9,4.1,4.8,5.9c0.5,0,6.4-5.5,7.5-4.8c3.6,2.5,5.3,18.7,4.4,22.7c-3.1,13.3-8.1,3.1-12.6,3.9
c-3.5,0.6-2.7,10.9-6.9,1.5c-1-2.3-3.6-17-8-16.2c-0.3,0-5.8,20.9-5.7,23.4c0.2,4-9.7,23.9-14.9,14c-2.2-4.1,9.8-11,3.8-16.5
c-4.4-4.1-27.2,16.5-29.8,17.4C1324.4,483,1304.9,499,1299.5,494.2C1296.1,491.2,1300.9,495.4,1299.5,494.2z"/>
<path d="M1164.5,445.2c-6.2-4-21.6,3.1-25.9-0.5c-2.5-2.1-3.5-7.4-4.3-10.5c-1.8-7.2-8.5,1.2-11.5,1.7
c-8.6,1.6-2.3-14.7-11.8-16.6c-5.7-1.1-11.2-5.9-14.2-10.8c-4.1-6.5,2.1-9.5,2-16.4c-0.5-20.5,20.5-2.6,25.2-13.5
c3.4-8,21-2.9,15.1,2.8c-3.6,3.5-18.9,27.8-2.4,18.6c4.8-2.7,5.7-9.2,12.7-8.4c7.6,0.9,15.1-12.2,8-17.2
c-1.4-1-17.1,12.4-14.5-0.4c0.8-4,3.6-8.9,2.9-13c-1-5.8-8.7-9-9.6-13.9c-1.5-8.6-12.8-11.2-15.6-18.9
c-2.9-7.9-5.3-27.5-11.6-32.7c-2.3-1.9-6.9-1.7-9.6-2.8c-8-3.2-0.4-7.8-3.4-12.8c-4.9-8.3,3.1-13.3-10.5-10.3
c-0.6,0.1-25.6-27.3-22.2-32.2c0.6-0.9,36.1,21.4,40,24.9c5.1,4.6,11.2,13.6,19.1,13.5c10.6-0.2,7.8,14.7,17.2,15.6
c13,1.3,3.8,9,9.4,15.9c7.1,8.8,13.5,9,25.5,10.1c5.1,0.5,10.3,7,14.6,6.4c7.3-1,19,1.1,25.3-1.6c5.1-2.1,14.3-9.7,20.6-2.7
c3.4,3.7-15.3,26.4-18,30.6c-4.6,7-9.5,26.5,0.5,11.4c5.8-8.7,7.7-18.6,14-27.5c6-8.4,8.6-3,15.6-0.7c4.7,1.6,9.1-4.5,14.5-1.6
c5.1,2.7,10.8,3.7,16,6c-1.4-0.6,1.9,11.3,2.3,11.9c3.7,4.8,12.7,8.6,13.9,15.1c1.1,5.9-6.4,16.2-9.8,20.9
c-11.1-10-10.3-8.5-23.3-2.9c-14.9,6.4-29.2,16.3-42.8,25c-10.7,6.9-27.9,21.2-41.4,17.3C1161.8,421,1173.1,450.8,1164.5,445.2 C1164.3,445.1,1165,445.5,1164.5,445.2z"/>
</g>
<g id="Nova_Scotia">
<title>Nova Scotia</title>
<desc>
<image xlink:href="peggys-cove-lighthouse.jpg" alt="A lighthouse at dusk, shot from below, with rocks in the foreground"></image>
<p>Canada’s second-smallest province is almost completely surrounded by water. It’s unique geographical history has also made it a valuable location for fossils, mostly from the Carboniferous, Triassic and Jurassic periods.</p>
</desc>
<path d="M1248.2,647.8c-16.9-0.6-15.6-20.1-10.6-30.6c2.5-5.3,6.1-10,8.5-15.3c1.7-3.7,14.2-8.2,13.3-12.9
c-0.3-1.7-15,13.1-15.3,5.5c-0.2-6.4,6.1-21.1,13.3-22.2c0.5-0.1,52.6-20.1,46.3-3.5c-3.1,8.3-11.1,17.4-17.1,23.9
c-2.9,3.2-10.1,15.6-12.8,16.9c-7.8,3.7-6,6.2-8.1,15.3C1263.8,634.2,1258.4,648.2,1248.2,647.8 C1242.2,647.6,1250.9,647.9,1248.2,647.8z"/>
<path d="M1301.1,561.2c-6.6-3.6-12.9-7.1-11.4-14.8c0.6-3.1,1.9-24.9,6.2-25.6c4.4-0.8,5.6,9.3,6.6,11.6c1.8,4.5,8.3,3.8,11.7,6.9
C1320.6,545.1,1305.8,563.7,1301.1,561.2C1300.2,560.7,1303.6,562.6,1301.1,561.2z"/>
</g>
<g id="Northwest_Territories">
<title>Northwest Territories</title>
<desc>
<image xlink:href="houseboats-yellowknife.jpg" alt="Rust-red houseboats on a blue river"></image>
<p>Part of Canada since 1870, the Northwest Territories were subdivided in 1999 to form the territory of Nunavut, gaining the portion that has a slightly warmer climate and taiga forest.</p>
</desc>
<path d="M234.5,41.9c-5.7,0.9-13.2,2.8-18,5.7c-2.2,1.3,2.7,11,0,11c-1.7-1.1-3.4-2.4-5-3.6c-7.1,1.3-12.7,38.2-14.1,44.7
c-2.7,12.4,4,11,14.1,16.8c8.6,5,3.9,12.9,2.3,20.7c-2,9.7-0.3,10.6,6.7,16.1c4,3.1,2.6,15.7-2.3,17.9
c-11.6,5.2,5.9,40.6,10.8,47.1c5.2,6.7,1.1,19.9,1.2,27.9c0.1,10.8-0.4,19.7,6.3,28.2c6,7.5,7.2,17,15.2,23.1
c2.7,2-4.1,12.9-1.7,17.3c1.9,3.4,20.7,8.1,24.5,6.6c6.1-2.3,5.6,9.9,6.3,13.5c0.5,2.8,0.6,11.8,3.4,12.4
c10.7,2.3,21.4,4.5,32.2,6.5c53.2,10,109.7,19.5,164,20.5c18.8,0.4,37.7,1.1,56.5,1c11.4,0,22.9,1.2,34.2,0.2
c9.1-0.9,3.6-16.1,3-22.3c-1.8-21.2-3.6-42.4-5.3-63.7c-0.8-10.2-1.8-20.4-2.4-30.5c-0.8-14-12.6-13.2-24.8-17.1
c-14.7-4.7-43.8-7.8-54.5-19.8c-8.6-9.7-11.1-14.4-24.4-14.8c-15-0.5-20.1-8.4-30.9-18.7c-18.5-17.7-37-35.4-55.4-53.2
c-12.6-12.3,1.8-31.9,0.4-47.8c-0.9-9.7-17.1-21.1-26.2-15.8c-7.4,4.3-14,12.5-9-1.2c1.5-4.1-2.1-18.2-8.1-10.8
c-1.7,2.2-11.3,20.8-14.9,10.4c-1.9-5.5-0.8-23.3-6.4-26.3c-7.1-3.8-11.9,6.3-19.6,5.1c-2.2-0.3,1.2-5.6-0.9-7.4
c-5.4-4.7-16.6-2.3-22.2,0.2c-4.6,2.1-21.6,2.6-23.3,7.5C243.5,58.2,238,41.4,234.5,41.9z M340.6,165.4c3.8-0.7,27.1-7.9,28.5-0.4
c0.7,3.7-10.6,11-4.8,12.8c8.1,2.4,16.8,2.4,24.8,4.8c4.9,1.5-0.7,8.9-2.7,10.6c-6.4,5.1-4.7,4.2-12.2,4c-8.2-2.1-11.6-4.6-13,5.6
c-1,7.3-7.9,12.9-15.3,14.2c-4,0.7,15.8-21.4-7.7-6.2c-4.3,2.7-11.4,1.1-14.3-3.1c-2.9-4.2,5.4-11.8,7.7-14.5
c2-2.4,10.2-7.8,10.5-11.1c0.5-6.9-15.9-4.5-19.4-5C300.1,173.6,335.9,166.2,340.6,165.4C366.3,160.9,327.2,167.7,340.6,165.4z
M396.7,286c5.9-1.1,24,20.1,29.1,23.5c11.7,7.7,22.3-3,29.6-10.1c12.5-12.2,21.4,1.6,8,8.2c-10.3,5-18.4,24.8-31.6,24.6
c-4.4-0.1-7.9,6.6-11.4,8.8c-5.4,3.5-12.2,3.2-18.5,3.3c-6.8,0.1-35.3-12.4-19.3-15.3c4.2-0.8,9.4,1,12.8-2.1
c4.6-4.2,10.4-5.2,14.4-8.8C415.3,313.4,394,286.5,396.7,286z"/>
</g>
<g id="Nunavut">
<title>Nunavut</title>
<desc>
<image xlink:href="iqaluit-nunavut.jpg" alt="Yellow buildings against a frozen ocean"></image>
<p>The largest Canadian territory, with a land area equivalent to Western Europe, it is also the newest, formed in 1999, and the least populous, with just over 30,000 permanent citizens. Nunavut also holds the northernmost permanently inhabited settlement in the world in the form of Alert, a military signals station and scientific outpost.</p>
</desc>
<path d="M668.5,369.2c-6.3-4.1-33.1,1.6-41.2,2.2c-14.6,1.1-32.6,5.2-47,3.1c-4.9-0.7-8.7-96.2-9.5-105.8 c-1.5-19.2-0.9-21.4-20-27.5c-18.1-5.8-38.8-9.7-55.9-18.1c-8.9-4.4-13.1-18.6-23.1-18.9c-10.2-0.3-17.4,1.2-25-6.1
c-12.7-12.1-25.3-24.3-38-36.5c-4.5-4.4-35-27.5-34.1-34.4c1.4-11.2,3.6-22.5,5.7-33.6c2.4-12.9,23.3,10.7,30.4,13.8
c6.5,2.9,9.9-1.4,15.9,2c6.6,3.7,11.1,8.8,14.8,15.4c4.5,8.1-28,15.2-7.9,21.3c13,4,32.1,5.4,44-2.8c8.1-5.6,23.8,23.2,27,28.5
c-0.2-0.3-4-20.5-3.4-22.1c0.5-1.4,20.5-17.3,18.7-17c-6.6,1.3-12.4,11-19.9,7.3c-7-3.5-3.3-11.7,1.9-14.8
c4.8-2.9,14.9-7.7,20.5-8c6.8-0.4,9.4,12.8,14,16.8c5.6,4.8,9.8,6.5,16.9,6.2c4.8-0.2,7.5,9.7,11.5,11c3.5,1.2,11.3-0.9,14.7-1.4
c7.5-1,18.4,1.6,25.1-0.3c-0.6,0.2,0.6-16.6,0.3-18c-1.2-6.9,24.5,0.3,27.7,1.4c4.5,1.4,1,13.9,0.6,17.7c-0.7,6.1,5.2,6.9,8,12.2
c0.2-4.4-11.1-27.6-1.9-26.8c19.4,1.5,11.5-21.7,8.1-29.5c-2.9-6.7,2.2-9.6-6.1-13.4c-7.4-3.4-12.6-3.3-17.7-10.6
c-2.5-3.5-4.2-10.7-2.8-14.9c1.8-5.5-6-8.8-6.8-13.4c-1-6,9.3-17.8,7.8-19.9c-3.6-5.2,8.6-24.5,15.2-14.5c3,4.6,9,6,12.6,10
c3.9,4.3,4.2,10.8,5.7,16.1c1.8,6.5,7.4,10.8,11.2,16.1c6.9,9.6,0.5,4.7-1.7,8.6c-1.2,2.1,0.8,14,2.7,15
c6.5,3.6,16.5-5.8,24.1,0.9c2.2,1.9-13.9,4.9-10.1,10.5c1.7,2.5,15.1,16.5,11.7,20.2c6.2-6.7-4.8-35.9,14-21.5
c5.9,4.5,10.9,8.7,12.8,16.2c1.6,6.3-5.6,17,2.9,21.7c4.3,2.4,7.7,13.2,12.7,6.9c4.7-6,2.2-18.3,3.4-25.7
c0.8-5.2,7.1-21.9,5.1-26.3c-2.9-6.2-10.6-11.1-9.6-19.3c2.2-18.2,33.2-0.3,41.4,2.2c12.6,3.8,3.8,7.1,9.1,12.2
c8.2,8,1,8.1-1.2,14.8c-1.5,1.4-2.9,2.8-4.2,4.3c0.9,3.3,5.8,5.5,7.2,9.1c3.3,8.6,12.8,7.4,12.2,19.4
c-0.6,12.8-6.3,35.2-22.9,26.4c14.6,15.5-19.6,6.8-22.5,7.9c-12.2,4.3,1.3,5.5,1.4,13.5c0,3.5-7.3,23.5-9.8,24
c13.3-2.4-2.8,34.2-4,36.9c-4.2,9.1-13.8,4.4-19.5,10.4c-2.4,2.5,0.3,7.1-1.7,9c-1.2,1.2-14.1,1.5-14.1,2.6c0,2,8.6,6.4,9.3,11.6
c1.2,9.8-17.1,14.5-17.1,14.6c2.5,11.6-11.7,27.2-16,40c-3.9,11.6-8,28.3-4.6,40.4C675.5,368.4,670.1,370.2,668.5,369.2
C668.3,369,668.8,369.4,668.5,369.2z"/>
<path d="M778.9,259.7c-3.8-0.1-2.1-8.5-4.8-10.3c-4.6-3.2-13.1,3.8-17.6-0.6c-2.9-2.8,3.2-9.6,4.1-12c2.8-7.2-2.2-18.1-3.1-25.5
c-0.8-5.9-4.9-33.3,6.7-31.1c5.3,1,6.6,8.6,10.6,11.1c4.9,3.1,15.1,4.1,20.9,6.8c2.9,1.3,17,5.7,17.8,9.4c0.3,1.4,6.7,11.3,8,11.4
c6,0.2,11.9-4.4,16.9,2.1c3.8,4.8-0.6,13.8-6.3,14.9c-3.2,0.6-12.8,0.3-16.2-0.1c-6.1-0.8-6.1-9-14.1-9.2
C794.7,226.6,795.1,260.4,778.9,259.7C777.5,259.7,780.4,259.8,778.9,259.7z"/>
</g>
<g id="Ontario">
<title>Ontario</title>
<desc>
<image xlink:href="parliament-hill-ottawa.jpg" alt="Old buildings of Parliament Hill reflected in a curve of the Ottawa river during fall"></image>
<p>Canada’s most populous province, with nearly 40% of the population, much of it clustered around Lake Ontario and in the city of Toronto, Canada’s largest city. Ontario also holds the nation’s capital of Ottawa.</p>
</desc>
<path d="M956.5,801.8c0.5-1.5,18.6-12,8.9-15.8c-5.3-2.1,5.4-20.4,5.7-22.4c2-11.2-5.1-20.3-1.1-32.1
c1.5-4.2-4.3-18.7-7.7-18.1c6.7-1.2,20.5,19.6,28.7,10.9c7.4-7.9-6-16.9-11.1-20.8c-17.9-13.6-41.1-6-61.8-3.7
c-4.9,0.5-13.6-3.8-17.3-6.5c-2.5-1.7-2.8-5.6-5.5-7.5c-6.2-4.5,0.5-1-0.7-5.9c-4.7-19.8-30.2-9.9-36.2-27.5
c-2.8-8.1-3.2-3.4-10.3-3.8c-6.5,1.6-15.4-3.4-20.3-1.8c-6.8,2.2-3.4,8.4-5.6,10.9c-3.9,4.4-11.6,16.4-17.4,18.1
c-13.5,3.9-39.4,5-51.4-3c-10.7-7-32.9,7.7-37.9-9.3c-2.2-7.4-8.3-6.2-9.5-13.9c-1.3-8.4-2.4-16.8-3.5-25.2
c-2.2-17.1-8.5-37.7-6.4-54.7c2.1-16.9,20.5-34.5,29-48.7c12.1-20.1,23.9-40.3,36.2-60.2c7.6-12.3,8.4-23.1,22.8-13.7
c6.8,4.4,9.1,10.2,18.5,10.3c8.9,0.1,22.4,4.2,29.9,8.9c10.1,6.2,27.8-1.2,39.3-1.8c19.8-1.1,5.6,14.4,14,24
c4.3,4.9,8.8,16.7,9.6,23.4c1.1,10.1,15.6,20.2,23.4,25.4c7,4.6,11.9,8.4,16.1,16c2.7,4.9,11.5-5.9,13.5,0.7
c7.1,22.8,13.6,45.8,20.7,68.6c3.7,11.9,6.1,25.7,13.2,36.2c10.1,14.9,26.7,11.2,42.1,13.5c3.6,0.5,8.5,3.9,12.2,3.2
c4.1-0.7,5.6,5.6,8.6,6.3c9,2.1,21.1-8.1,27.6-12.3c14.6-9.3,2.2,14.3-0.1,17.7c-6.3,9.2-14,19.6-19.3,29.1
c-5,8.9-14.2,8.6-23.4,12.8c-3.1,1.5-31.8,21-17.6,24.2c30.8,6.9-25,16.7-7.1,22c-8.7,4.1-17.4-0.7-24.3,7.7
c-9.7,11.8-11.1,17.6-25.8,21.6C955.9,803.8,956.2,802.8,956.5,801.8z"/>
</g>
<g id="Prince_Edward_Island">
<title>Prince Edward Island</title>
<desc>
<image xlink:href="pink-beach-boardwalk.jpg" alt="A beach boardwalk through pink grass"></image>
<p>The smallest province in both land area and population, Prince Edward Island grows 25% of the nation's potatoes.</p>
</desc>
<path d="M1271,565.2c-7.2-5-45.3,11.5-34.9-9.9c1.9-3.9,11,4.2,15.9,2.1c2-0.8,21.5-8.9,22-8.5
C1275.1,550.2,1272.8,566.4,1271,565.2C1270.7,564.9,1272.7,566.3,1271,565.2z"/>
</g>
<g id="Quebec">
<title>Quebec</title>
<desc>
<image xlink:href="old-quebec.jpg" alt="Photograph of Quebec city showing old and modern buildings against a lake, behind a green hill"></image>
<p>Quebec is Canada’s second-largest province, and the only one to use French as its sole official language. Independence movements have played a significant role in the history and politics of the province.</p>
</desc>
<path d="M1085.3,673.4c-6.2-7.2-6.3-12.8-17.3-4.6c-5.2,3.9-14.9,12.6-22.6,8.4c-6.8-3.8-11.8-6.9-20.1-8.2
c-12.3-1.8-27.4,2.3-37-8.3c-12-13.3-15.1-37-20.3-53.8c-6.2-20.2-10.7-41.4-18.6-61c-1.8-4.4,3.1-2.3,4.3-5.1
c1.1-2.6-1.3-6.5,0.2-10.1c4.3-10-5.2-17.6-10-25.7c-4.2-7-6.2-13.6-9.7-20.7c-2.1-4.3-17.2-14.7-13.6-20.3
c11.2-17.2,30.4-31,27.3-54.7c-1.6-11.7-7.4-20.2-11.9-30.7c-4.9-11.6-21.1-13.4-30.1-19.7c-12.9-8.9,1.3-26.9,0.2-38.6
c-0.6-6.7-8.2-16.5-12.8-20.7c-6.9-6.4-1.6-20.5-8.4-26.3c-12.5-10.5-11.9-25,5-28.4c9.7-2,23.2,3.5,30.8-4.5
c8.5-9,7.8-8.9,20.1-5c6.1,2,18.8,4.2,23,9.6c6.3,8,3.9,8.8,15.5,8.1c4.6-0.3,20.3-2.5,20.6,3.6c0.6,11.1,9.1,18.4,10.6,28.9
c0.5,3.6,11,15.1,14.1,14.2c9.8-3,12.7,4.4,21.9,5.1c13.6,0.9,18.9-26.9,14.8-38.8c-0.6-1.8-6.4-23.7,0.8-20.8
c2.1,0.8,12.8,16.3,14.4,19.5c4.2,8.6,3.5,11,14.1,7.1c2.7,15.7-0.7,20.4,15.2,26.1c10.3,3.6,5.2,33.3,17.4,39.4
c9,4.5,20,22.1,17.7,31.3c-1.1,4.6-10,3.3-14.3,3.2c-5.6-0.2-3.7,5.8-7.8,7.8c-1.4,0.7-10.4-2.1-11.9-2.1
c-8.8-0.2-17.5,20.9-14.9,29c2.2,6.8,7.5,11.5,13.7,14.7c3.1,1.6,8,1.9,8.7,6.2c0.7,4.7-2.3,7.4,2.5,10.3
c6.9,4.1,12.8-6.3,15.7,2.6c3.5,10.9,9,6.6,17.5,6.3c7.1-0.2,12.5,2.4,20.4,0.6c6.5-1.5,1.8-14.2,2.2-18.9
c-0.8,9.4,52.9-21.3,54-21.9c7.9-4.8,41.4-30.5,49.6-22.9c9.3,8.5-1.6,12.2-7.6,21c-5.6,8.2-6,19.3-8.6,28.7
c-5.4,19.3-27.4,27-44.1,35.3c-17.4,8.6-40.1,16.9-54,30.9c-5.1,5.2-3.3,15.5-4.2,22.1c-1.1,8.8-10,12.1-13.9,20.5
c-8.8,18.8-9,40-17.6,59c-2.4,5.4-30.8,43.4-28.3,45.1c0.8,0.6,33.5-48.1,35.1-52.5c6-16,6.6-31.2,17.4-45.3
c11.3-14.7,26.9-35.5,45.2-41.3c9.3-2.9,19.8,2.9,20.4,13.1c0.8,13.7-10.7,19.5-21.2,23.2c-9.3,3.3-13.7,9.4-21.6,13.8
c-5.4,3-18.5,1.7-17,10.6c1.4,8,4.1,9.4-0.5,14.1c-9.8,3.4-11,2.7-12.4,14.4c-2.4,19.8,4.9,39.4-7.1,56.5
C1130.2,661.2,1093.8,683.3,1085.3,673.4C1084.1,672,1087.1,675.5,1085.3,673.4z"/>
<path d="M1219.1,494.1c-4.7,0.1-25.9-1.9-19.3-9.5c7-8.2,27-7.1,36.7-5.7C1262.5,482.7,1229.5,493.9,1219.1,494.1
C1217.7,494.1,1221.8,494,1219.1,494.1z"/>
</g>
<g id="Saskatchewan">
<title>Saskatchewan</title>
<desc>
<image xlink:href="neidpath-saskatchewan.jpg" alt="Old weathered grain silos against a blue sky"></image>
<p>Saskatchewan is a completely land-locked province located near the geographical center of the country. It's location and lack of any large open bodies of water creates an environment with the greatest range of temperature in Canada, from 40°C in the summer to -40°C in winter.</p>
</desc>
<path d="M598.6,672.2c-4.5-2.9-22.1,1.4-28,1.8c-8.2,0.6-16.5,1.3-24.8,1.3c-23.4-0.2-46.8-1.8-70.1-2.7
c-2.9-0.1-21.6,0.6-21.2-2.6c0.8-6.1,0.8-12.3,1.2-18.4c1.2-19.3,2.3-38.6,3.4-57.8c2.6-45.4,5.3-90.8,8-136.3
c0.7-11.4,1.4-22.8,2.1-34.2c0.2-3.6-1-19.1,1.3-21.2c3.8-3.7,49.9-4,49.8-5c-0.5-3-19.9-6.3-22.6-7c-3.9-0.9-8.1-1.8-12.1-1.1
c-0.4,0.1-14.3,0-14.1,0c-1.6-0.4-0.4-9.5,0.1-10.7c0.7-2,9.7-0.6,10.2-0.6c7.8,0.2,15.6,0.3,23.4,0.4c14.8,0.2,29.6,0.4,44.5,0.7
c4.9,0.1,26.4-2.9,27.2,3.1c1.8,13.9,1.4,28.3,2,42.3c0.4,10.1-3.8,11.3-7.8,19.5c-2.8,5.7,0.6,9.7,2.1,15.1
c0.9,3.5-4.5,11.6-2.9,13.5c2.3,2.6,7-8.2,8.8-4.7c3.6,7,2.5,18.4,3.3,26c2.1,20.1,4.1,40.2,6.3,60.3c2.3,20.4,4.1,40.9,6.5,61.3
c1.4,11.5,2.4,23,3.7,34.4C599.2,652.8,601.6,674.1,598.6,672.2C598.4,672,600.7,673.5,598.6,672.2z"/>
</g>
<g id="Yukon">
<title>Yukon</title>
<desc>
<image xlink:href="yukon.jpg" alt="A range of rocky snowcapped mountains, partly hidden by cloud"></image>
<p>The Yukon largely escaped glaciation during the last Ice Age 10,000 years ago, making it a welcome home for the First Nations of the north. Today ¾ of the population lives in the territory’s only city of Whitehorse; the second-largest habitation has just 2000 people.</p>
</desc>
<path d="M276.8,345.7c-33.5-14.4-71.1-20.8-105.3-34.3c-23.8-9.4-47.8-18.8-71.1-29.3c-7.5-3.3-14-4.6-9.2-13.6
c7.7-14.4,0.4-6-10.3-9.9c-17.6-6.4-3.1-23.3,2.8-36.7c10.5-23.6,21-47.3,31.5-71c19-42.9,38-85.8,57-128.7
c8.1-18.3,20.1,9.3,24.5,17.1c3.2,5.6,12.7,11.5,10.3,17c-3.5,7.7-6.8,15.8-9.2,23.9c-2.3,7.9-5.7,19.1-5.8,27.2
c-0.1,6.1,14.7,10,18.7,12.8c6.8,4.7-1.7,18.5-1.2,25.5c0.7,8.1,8.3,7,9.1,15.1c0.9,9.9-1.8,3.6-5.9,10.9c-1.6,2.9-0.9,7.4-2,10.6
c-1.1,2.8,5.3,18.2,8,20.9c13.7,13.4,8.9,42.6,9.2,59.5c0.3,14,21,26.2,18.9,39.9c-2.5,16.9,13.6,24.7,29.5,22.5
C276.9,329.2,281.4,347.6,276.8,345.7z"/>
</g>
</svg>
<div id="provinceInfo"></div>
* { box-sizing: border-box; }
body {
background: #88a;
color: #fff;
font-family: Avenir, Calibri, sans-serif;
}
#canada-map {
fill: hsl(120, 55%, 20%);
}
#canada-map g {
transition: .3s;
}
#canada-map g:hover {
fill: hsl(120, 55%, 40%);
cursor: pointer;
}
.active, .active:hover {
fill: hsl(240, 55%, 40%) !important;
}
#provinceInfo {
position: absolute;
top: 0; right: 0;
width: 25%;
background: rgba(0,0,0,0.2);
pointer-events: none;
opacity: 0;
transition: 1s;
}
@media all and (max-width: 800px) {
#provinceInfo { width: 40%; }
}
@media all and (max-width: 750px) {
#provinceInfo {
width: 100%;
position: static;
background: none;
}
#provinceInfo.show p {
color: #000 !important;
margin-bottom: 2rem;
}
}
#provinceInfo.show { opacity: 1; }
#provinceInfo h1 {
background: hsl(240, 55%, 40%);
padding: .3rem;
padding-left: 1rem;
margin-top: -.5rem;
font-weight: 400;
}
#provinceInfo p {
margin-left: 2rem;
margin-right: 2rem;
}
#provinceInfo img {
width: 100%;
}
var canadamap = document.getElementById("canada-map"),
provinceInfo = document.getElementById("provinceInfo"),
allProvinces = canadamap.querySelectorAll("g");
canadamap.addEventListener("click", function(e){
var province = e.target.parentNode;
if(e.target.nodeName == "path") {
for (var i=0; i < allProvinces.length; i++) {
allProvinces[i].classList.remove("active");
}
province.classList.add("active");
var provinceName = province.querySelector("title").innerHTML,
provincePara = province.querySelector("desc p");
sourceImg = province.querySelector("img"),
imgPath = "https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/";
provinceInfo.innerHTML = "";
provinceInfo.insertAdjacentHTML("afterbegin", "<img src="+imgPath + sourceImg.getAttribute('xlink:href')+" alt='"+sourceImg.getAttribute('alt')+"'><h1>"+provinceName+"</h1><p>"+provincePara.innerHTML+"</p>");
provinceInfo.classList.add("show");
}
})
Also see: Tab Triggers