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.
<main>
<div class="table-wrapper">
<table>
<thead>
<tr>
<th data-type="text" scope="col" role="columnheader">name</th>
<th data-type="text" scope="col" role="columnheader">code</th>
<th data-type="text" scope="col" role="columnheader">emoji</th>
<th data-type="text" scope="col" role="columnheader">category</th>
<th data-type="text" scope="col" role="columnheader">cldr short name</th>
<th data-type="text" scope="col" role="columnheader">alt names</th>
<th data-type="number" scope="col" role="columnheader">emoji version</th>
<th data-type="number" scope="col" role="columnheader">unicode version</th>
</tr>
</thead>
<tbody id="tableData">
<tr>
<td>grapes</td>
<td>U+1F347</td>
<td>๐</td>
<td>fruit</td>
<td>grapes</td>
<td>grape</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>melon</td>
<td>U+1F348</td>
<td>๐</td>
<td>fruit</td>
<td>melon</td>
<td>cantaloupe, honeydew, muskmelon</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>watermelon</td>
<td>U+1F349</td>
<td>๐</td>
<td>fruit</td>
<td>watermelon</td>
<td> </td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>tangerine</td>
<td>U+1F34A</td>
<td>๐</td>
<td>fruit</td>
<td>tangerine</td>
<td>mandarin, orange</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>lemon</td>
<td>U+1F34B</td>
<td>๐</td>
<td>fruit</td>
<td>lemon</td>
<td>lemonade</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>banana</td>
<td>U+1F34C</td>
<td>๐</td>
<td>fruit</td>
<td>banana</td>
<td>plantain</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>pineapple</td>
<td>U+1F34D</td>
<td>๐</td>
<td>fruit</td>
<td>pineapple</td>
<td> </td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>mango</td>
<td>U+1F96D</td>
<td>๐ฅญ</td>
<td>fruit</td>
<td>โ mango</td>
<td> </td>
<td>11.0</td>
<td>11.0</td>
</tr>
<tr>
<td>red apple</td>
<td>U+1F34E</td>
<td>๐</td>
<td>fruit</td>
<td>red apple</td>
<td>red delicious apple</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>green apple</td>
<td>U+1F34F</td>
<td>๐</td>
<td>fruit</td>
<td>green apple</td>
<td>golden delicious apple, granny smith apple</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>pear</td>
<td>U+1F350</td>
<td>๐</td>
<td>fruit</td>
<td>pear</td>
<td> </td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>peach</td>
<td>U+1F351</td>
<td>๐</td>
<td>fruit</td>
<td>peach</td>
<td>bottom, butt</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>cherries</td>
<td>U+1F352</td>
<td>๐</td>
<td>fruit</td>
<td>cherries</td>
<td>cherry, wild cherry</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>strawberry</td>
<td>U+1F353</td>
<td>๐</td>
<td>fruit</td>
<td>strawberry</td>
<td> </td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>kiwifruit</td>
<td>U+1F95D</td>
<td>๐ฅ</td>
<td>fruit</td>
<td>kiwi fruit</td>
<td>chinese gooseberry, kiwi</td>
<td>3.0</td>
<td>9.0</td>
</tr>
<tr>
<td>tomato</td>
<td>U+1F345</td>
<td>๐
</td>
<td>fruit</td>
<td>tomato</td>
<td> </td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>coconut</td>
<td>U+1F965</td>
<td>๐ฅฅ</td>
<td>fruit</td>
<td>coconut</td>
<td>cocoanut</td>
<td>5.0</td>
<td>10.0</td>
</tr>
<tr>
<td>avocado</td>
<td>U+1F951</td>
<td>๐ฅ</td>
<td>vegetable</td>
<td>avocado</td>
<td> </td>
<td>3.0</td>
<td>9.0</td>
</tr>
<tr>
<td>eggplant</td>
<td>U+1F346</td>
<td>๐</td>
<td>vegetable</td>
<td>eggplant</td>
<td>eggplant, phallic, purple vegetable</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>potato</td>
<td>U+1F954</td>
<td>๐ฅ</td>
<td>vegetable</td>
<td>potato</td>
<td>baked potato, idaho potato</td>
<td>3.0</td>
<td>9.0</td>
</tr>
<tr>
<td>carrot</td>
<td>U+1F955</td>
<td>๐ฅ</td>
<td>vegetable</td>
<td>carrot</td>
<td> </td>
<td>3.0</td>
<td>9.0</td>
</tr>
<tr>
<td>corn</td>
<td>U+1F33D</td>
<td>๐ฝ</td>
<td>vegetable</td>
<td>ear of corn</td>
<td>corn, corn on the cob</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>hot pepper</td>
<td>U+1F336</td>
<td>๐ถ</td>
<td>vegetable</td>
<td>hot pepper</td>
<td>chili pepper, spicy</td>
<td>1.0</td>
<td>7.0</td>
</tr>
<tr>
<td>cucumber</td>
<td>U+1F952</td>
<td>๐ฅ</td>
<td>vegetable</td>
<td>cucumber</td>
<td>gherkin, pickle</td>
<td>3.0</td>
<td>9.0</td>
</tr>
<tr>
<td>leafy green</td>
<td>U+1F96C</td>
<td>๐ฅฌ</td>
<td>vegetable</td>
<td>โ leafy green</td>
<td> </td>
<td>11.0</td>
<td>11.0</td>
</tr>
<tr>
<td>broccoli</td>
<td>U+1F966</td>
<td>๐ฅฆ</td>
<td>vegetable</td>
<td>broccoli</td>
<td> </td>
<td>5.0</td>
<td>10.0</td>
</tr>
<tr>
<td>mushroom</td>
<td>U+1F344</td>
<td>๐</td>
<td>vegetable</td>
<td>mushroom</td>
<td>shroom, toadstool</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>peanuts</td>
<td>U+1F95C</td>
<td>๐ฅ</td>
<td>vegetable</td>
<td>peanuts</td>
<td> </td>
<td>3.0</td>
<td>9.0</td>
</tr>
<tr>
<td>chestnut</td>
<td>U+1F330</td>
<td>๐ฐ</td>
<td>vegetable</td>
<td>chestnut</td>
<td>acorn, nut</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>bread</td>
<td>U+1F35E</td>
<td>๐</td>
<td>prepared</td>
<td>bread</td>
<td>loaf of bread</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>croissant</td>
<td>U+1F950</td>
<td>๐ฅ</td>
<td>prepared</td>
<td>croissant</td>
<td> </td>
<td>3.0</td>
<td>9.0</td>
</tr>
<tr>
<td>french bread</td>
<td>U+1F956</td>
<td>๐ฅ</td>
<td>prepared</td>
<td>baguette bread</td>
<td> </td>
<td>3.0</td>
<td>9.0</td>
</tr>
<tr>
<td>pretzel</td>
<td>U+1F968</td>
<td>๐ฅจ</td>
<td>prepared</td>
<td>pretzel</td>
<td> </td>
<td>5.0</td>
<td>10.0</td>
</tr>
<tr>
<td>bagel</td>
<td>U+1F96F</td>
<td>๐ฅฏ</td>
<td>prepared</td>
<td>โ bagel</td>
<td> </td>
<td>11.0</td>
<td>11.0</td>
</tr>
<tr>
<td>pancakes</td>
<td>U+1F95E</td>
<td>๐ฅ</td>
<td>prepared</td>
<td>pancakes</td>
<td>crรชpes</td>
<td>3.0</td>
<td>9.0</td>
</tr>
<tr>
<td>cheese</td>
<td>U+1F9C0</td>
<td>๐ง</td>
<td>prepared</td>
<td>cheese wedge</td>
<td>cheese</td>
<td>1.0</td>
<td>8.0</td>
</tr>
<tr>
<td>beef</td>
<td>U+1F356</td>
<td>๐</td>
<td>prepared</td>
<td>meat on bone</td>
<td>ano niku, barbecue, bbq, manga meat</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>chicken</td>
<td>U+1F357</td>
<td>๐</td>
<td>prepared</td>
<td>poultry leg</td>
<td>chicken drumstick, turkey leg</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>steak</td>
<td>U+1F969</td>
<td>๐ฅฉ</td>
<td>prepared</td>
<td>cut of meat</td>
<td>steak</td>
<td>5.0</td>
<td>10.0</td>
</tr>
<tr>
<td>bacon</td>
<td>U+1F953</td>
<td>๐ฅ</td>
<td>prepared</td>
<td>bacon</td>
<td> </td>
<td>3.0</td>
<td>9.0</td>
</tr>
<tr>
<td>hamburger</td>
<td>U+1F354</td>
<td>๐</td>
<td>prepared</td>
<td>hamburger</td>
<td>burger, cheeseburger</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>french fries</td>
<td>U+1F35F</td>
<td>๐</td>
<td>prepared</td>
<td>french fries</td>
<td>fries, mcdonalds fries</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>pizza</td>
<td>U+1F355</td>
<td>๐</td>
<td>prepared</td>
<td>pizza</td>
<td>pepperoni pizza, pizza</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>hotdog</td>
<td>U+1F32D</td>
<td>๐ญ</td>
<td>prepared</td>
<td>hot dog</td>
<td>hotdog, sausage</td>
<td>1.0</td>
<td>8.0</td>
</tr>
<tr>
<td>sandwich</td>
<td>U+1F96A</td>
<td>๐ฅช</td>
<td>prepared</td>
<td>sandwich</td>
<td> </td>
<td>5.0</td>
<td>10.0</td>
</tr>
<tr>
<td>taco</td>
<td>U+1F32E</td>
<td>๐ฎ</td>
<td>prepared</td>
<td>taco</td>
<td> </td>
<td>1.0</td>
<td>8.0</td>
</tr>
<tr>
<td>burrito</td>
<td>U+1F32F</td>
<td>๐ฏ</td>
<td>prepared</td>
<td>burrito</td>
<td>wrap</td>
<td>1.0</td>
<td>8.0</td>
</tr>
<tr>
<td>pita pocket</td>
<td>U+1F959</td>
<td>๐ฅ</td>
<td>prepared</td>
<td>stuffed flatbread</td>
<td>doner kebab, shawarma, souvlaki</td>
<td>3.0</td>
<td>9.0</td>
</tr>
<tr>
<td>egg</td>
<td>U+1F95A</td>
<td>๐ฅ</td>
<td>prepared</td>
<td>egg</td>
<td> </td>
<td>3.0</td>
<td>9.0</td>
</tr>
<tr>
<td>fried egg</td>
<td>U+1F373</td>
<td>๐ณ</td>
<td>prepared</td>
<td>cooking</td>
<td>breakfast, fried egg, frying pan</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>casserole</td>
<td>U+1F958</td>
<td>๐ฅ</td>
<td>prepared</td>
<td>shallow pan of food</td>
<td>paella</td>
<td>3.0</td>
<td>9.0</td>
</tr>
<tr>
<td>stew</td>
<td>U+1F372</td>
<td>๐ฒ</td>
<td>prepared</td>
<td>pot of food</td>
<td>bowl of food</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>soup</td>
<td>U+1F963</td>
<td>๐ฅฃ</td>
<td>prepared</td>
<td>bowl with spoon</td>
<td>cereal bowl</td>
<td>5.0</td>
<td>10.0</td>
</tr>
<tr>
<td>salad</td>
<td>U+1F957</td>
<td>๐ฅ</td>
<td>prepared</td>
<td>green salad</td>
<td> </td>
<td>3.0</td>
<td>9.0</td>
</tr>
<tr>
<td>popcorn</td>
<td>U+1F37F</td>
<td>๐ฟ</td>
<td>prepared</td>
<td>popcorn</td>
<td>popping corn</td>
<td>1.0</td>
<td>8.0</td>
</tr>
<tr>
<td>salt</td>
<td>U+1F9C2</td>
<td>๐ง</td>
<td>prepared</td>
<td>โ salt</td>
<td> </td>
<td>11.0</td>
<td>11.0</td>
</tr>
<tr>
<td>canned soup</td>
<td>U+1F96B</td>
<td>๐ฅซ</td>
<td>prepared</td>
<td>canned food</td>
<td> </td>
<td>5.0</td>
<td>10.0</td>
</tr>
<tr>
<td>bento box</td>
<td>U+1F371</td>
<td>๐ฑ</td>
<td>asian</td>
<td>bento box</td>
<td>lunch box</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>rice crackers</td>
<td>U+1F358</td>
<td>๐</td>
<td>asian</td>
<td>rice cracker</td>
<td> </td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>onigiri</td>
<td>U+1F359</td>
<td>๐</td>
<td>asian</td>
<td>rice ball</td>
<td>nori, triangle rice</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>rice</td>
<td>U+1F35A</td>
<td>๐</td>
<td>asian</td>
<td>cooked rice</td>
<td>boiled rice, bowl of rice, rice, steamed rice</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>curry rice</td>
<td>U+1F35B</td>
<td>๐</td>
<td>asian</td>
<td>curry rice</td>
<td>curry, indian food</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>noodles</td>
<td>U+1F35C</td>
<td>๐</td>
<td>asian</td>
<td>steaming bowl</td>
<td>noodles, noodles with chopsticks, ramen</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>spaghetti</td>
<td>U+1F35D</td>
<td>๐</td>
<td>asian</td>
<td>spaghetti</td>
<td>pasta, spaghetti bolognese</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>sweet potato</td>
<td>U+1F360</td>
<td>๐ </td>
<td>asian</td>
<td>roasted sweet potato</td>
<td>potato, sweet potato, yam</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>oden</td>
<td>U+1F362</td>
<td>๐ข</td>
<td>asian</td>
<td>oden</td>
<td>kebab, skewer</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>sushi</td>
<td>U+1F363</td>
<td>๐ฃ</td>
<td>asian</td>
<td>sushi</td>
<td>sashimi, seafood</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>fried shrimp</td>
<td>U+1F364</td>
<td>๐ค</td>
<td>asian</td>
<td>fried shrimp</td>
<td>ebi furai, fried prawn, tempura</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>fish cake</td>
<td>U+1F365</td>
<td>๐ฅ</td>
<td>asian</td>
<td>fish cake with swirl</td>
<td>fishcake, narutomaki, pink swirl</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>moon cake</td>
<td>U+1F96E</td>
<td>๐ฅฎ</td>
<td>asian</td>
<td>โ moon cake</td>
<td> </td>
<td>11.0</td>
<td>11.0</td>
</tr>
<tr>
<td>dango</td>
<td>U+1F361</td>
<td>๐ก</td>
<td>asian</td>
<td>dango</td>
<td>dessert stick, pink white green balls</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>dumpling</td>
<td>U+1F95F</td>
<td>๐ฅ</td>
<td>asian</td>
<td>dumpling</td>
<td>empanada, gyลza, pierogi</td>
<td>5.0</td>
<td>10.0</td>
</tr>
<tr>
<td>fortune cookie</td>
<td>U+1F960</td>
<td>๐ฅ </td>
<td>asian</td>
<td>fortune cookie</td>
<td> </td>
<td>5.0</td>
<td>10.0</td>
</tr>
<tr>
<td>chinese takeout</td>
<td>U+1F961</td>
<td>๐ฅก</td>
<td>asian</td>
<td>takeout box</td>
<td>chinese food box, oyster pail</td>
<td>5.0</td>
<td>10.0</td>
</tr>
<tr>
<td>crab</td>
<td>U+1F980</td>
<td>๐ฆ</td>
<td>marine</td>
<td>crab</td>
<td>crab cancer, red crab</td>
<td>1.0</td>
<td>8.0</td>
</tr>
<tr>
<td>lobster</td>
<td>U+1F99E</td>
<td>๐ฆ</td>
<td>marine</td>
<td>โ lobster</td>
<td> </td>
<td>11.0</td>
<td>11.0</td>
</tr>
<tr>
<td>shrimp</td>
<td>U+1F990</td>
<td>๐ฆ</td>
<td>marine</td>
<td>shrimp</td>
<td> </td>
<td>3.0</td>
<td>9.0</td>
</tr>
<tr>
<td>squid</td>
<td>U+1F991</td>
<td>๐ฆ</td>
<td>marine</td>
<td>squid</td>
<td> </td>
<td>3.0</td>
<td>9.0</td>
</tr>
<tr>
<td>soft-serve</td>
<td>U+1F366</td>
<td>๐ฆ</td>
<td>sweet</td>
<td>soft ice cream</td>
<td>mr whippy, soft serve</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>shaved ice</td>
<td>U+1F367</td>
<td>๐ง</td>
<td>sweet</td>
<td>shaved ice</td>
<td>snow cone</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>ice cream</td>
<td>U+1F368</td>
<td>๐จ</td>
<td>sweet</td>
<td>ice cream</td>
<td>bowl of ice cream, dessert</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>doughnut</td>
<td>U+1F369</td>
<td>๐ฉ</td>
<td>sweet</td>
<td>doughnut</td>
<td>donut</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>cookie</td>
<td>U+1F36A</td>
<td>๐ช</td>
<td>sweet</td>
<td>cookie</td>
<td>biscuit, chocolate cookie</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>birthday cake</td>
<td>U+1F382</td>
<td>๐</td>
<td>sweet</td>
<td>birthday cake</td>
<td>birthday, cake, cake with candles</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>shortcake</td>
<td>U+1F370</td>
<td>๐ฐ</td>
<td>sweet</td>
<td>shortcake</td>
<td>cake, piece of cake, strawberry shortcake</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>cupcake</td>
<td>U+1F9C1</td>
<td>๐ง</td>
<td>sweet</td>
<td>โ cupcake</td>
<td> </td>
<td>11.0</td>
<td>11.0</td>
</tr>
<tr>
<td>pie</td>
<td>U+1F967</td>
<td>๐ฅง</td>
<td>sweet</td>
<td>pie</td>
<td> </td>
<td>5.0</td>
<td>10.0</td>
</tr>
<tr>
<td>chocolate bar</td>
<td>U+1F36B</td>
<td>๐ซ</td>
<td>sweet</td>
<td>chocolate bar</td>
<td>block of chocolate</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>candy</td>
<td>U+1F36C</td>
<td>๐ฌ</td>
<td>sweet</td>
<td>candy</td>
<td>lolly, sweet</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>lollipop</td>
<td>U+1F36D</td>
<td>๐ญ</td>
<td>sweet</td>
<td>lollipop</td>
<td>android lollipop, lollypop</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>custard flan</td>
<td>U+1F36E</td>
<td>๐ฎ</td>
<td>sweet</td>
<td>custard</td>
<td>creme caramel, dessert, flan, pudding</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>honey</td>
<td>U+1F36F</td>
<td>๐ฏ</td>
<td>sweet</td>
<td>honey pot</td>
<td>honey, pot</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>baby formula</td>
<td>U+1F37C</td>
<td>๐ผ</td>
<td>drink</td>
<td>baby bottle</td>
<td>bottle feeding</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>milk</td>
<td>U+1F95B</td>
<td>๐ฅ</td>
<td>drink</td>
<td>glass of milk</td>
<td> </td>
<td>3.0</td>
<td>9.0</td>
</tr>
<tr>
<td>coffee</td>
<td>U+2615</td>
<td>โ</td>
<td>drink</td>
<td>hot beverage</td>
<td>coffee, hot chocolate, tea</td>
<td>1.0</td>
<td>4.0</td>
</tr>
<tr>
<td>green tea</td>
<td>U+1F375</td>
<td>๐ต</td>
<td>drink</td>
<td>teacup without handle</td>
<td>green tea, matcha, matcha green tea</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>sake</td>
<td>U+1F376</td>
<td>๐ถ</td>
<td>drink</td>
<td>sake</td>
<td>bottle, rice wine</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>champagne</td>
<td>U+1F37E</td>
<td>๐พ</td>
<td>drink</td>
<td>bottle with popping cork</td>
<td>celebration, champagne, sparking wine</td>
<td>1.0</td>
<td>8.0</td>
</tr>
<tr>
<td>red wine</td>
<td>U+1F377</td>
<td>๐ท</td>
<td>drink</td>
<td>wine glass</td>
<td>alcohol, red wine, wine</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>martini</td>
<td>U+1F378</td>
<td>๐ธ</td>
<td>drink</td>
<td>cocktail glass</td>
<td>martini</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>tropical drink</td>
<td>U+1F379</td>
<td>๐น</td>
<td>drink</td>
<td>tropical drink</td>
<td>fruit punch, tiki cocktail, tiki drink</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>beer</td>
<td>U+1F37A</td>
<td>๐บ</td>
<td>drink</td>
<td>beer mug</td>
<td>beer stein, lager</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>2 beers</td>
<td>U+1F37B</td>
<td>๐ป</td>
<td>drink</td>
<td>clinking beer mugs</td>
<td>beers, cheers</td>
<td>1.0</td>
<td>6.0</td>
</tr>
<tr>
<td>2 glasses of champagne</td>
<td>U+1F942</td>
<td>๐ฅ</td>
<td>drink</td>
<td>clinking glasses</td>
<td>celebration, champagne glasses, cheers</td>
<td>3.0</td>
<td>9.0</td>
</tr>
<tr>
<td>whiskey</td>
<td>U+1F943</td>
<td>๐ฅ</td>
<td>drink</td>
<td>tumbler glass</td>
<td>bourbon, rum, whiskey, whisky</td>
<td>3.0</td>
<td>9.0</td>
</tr>
<tr>
<td>soft drink</td>
<td>U+1F964</td>
<td>๐ฅค</td>
<td>drink</td>
<td>cup with straw</td>
<td>milkshake, soda, soft drink</td>
<td>5.0</td>
<td>10.0</td>
</tr>
</tbody>
</table>
</div>
</main>
main {
display: flex;
flex-direction: column;
padding: 1em;
align-items: center;
}
.table-wrapper {
overflow: auto;
max-width: 100%;
background: linear-gradient(to right, white 30%, rgba(255, 255, 255, 0)),
linear-gradient(to right, rgba(255, 255, 255, 0), white 70%) 0 100%,
radial-gradient(
farthest-side at 0% 50%,
rgba(0, 0, 0, 0.2),
rgba(0, 0, 0, 0)
),
radial-gradient(
farthest-side at 100% 50%,
rgba(0, 0, 0, 0.2),
rgba(0, 0, 0, 0)
)
0 100%;
background-repeat: no-repeat;
background-color: white;
background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
background-position: 0 0, 100%, 0 0, 100%;
background-attachment: local, local, scroll, scroll;
}
tr {
border-bottom: 1px solid;
}
th {
background-color: #555;
color: #fff;
white-space: nowrap;
cursor: pointer;
}
th,
td {
text-align: left;
padding: 0.5em 1em;
}
.active {
font-style: italic;
}
.asc::after {
font-style: normal;
content: "\25B4";
margin-left: 0.5em;
}
.desc::after {
font-style: normal;
content: "\25BE";
margin-left: 0.5em;
}
const tableData = document.getElementById('tableData')
const thead = tableData.previousElementSibling
const rows = [...tableData.rows]
const orders = [1, 1, 1, 1, 1, 1, 1, 1]
const sort = (header, col, type) => {
let rowCount = rows.length
rows.sort((a, b) => {
if (type === 'text') {
let i = a.children[col].firstChild.nodeValue,
j = b.children[col].firstChild.nodeValue
return i === j ? 0 : i > j ? orders[col] : -orders[col]
} else if (type === 'number') {
let i = parseInt(a.children[col].firstChild.nodeValue),
j = parseInt(b.children[col].firstChild.nodeValue)
return i === j ? 0 : i > j ? orders[col] : -orders[col]
}
})
orders[col] *= -1
activeHeader(header)
sortIndicator(header, orders[col])
while (tableData.lastChild) tableData.lastChild.remove()
while (rowCount--) tableData.prepend(rows[rowCount])
}
const activeHeader = header => {
const thArray = Array.prototype.slice.call(thead.querySelectorAll('th'));
thArray.forEach(th => {
th.className = ''
th.removeAttribute('aria-label')
if (th === header) {
th.classList.add('active')
}
})
}
const sortIndicator = (header, ordering) => {
if (ordering === 1) {
header.classList.remove('asc')
header.classList.add('desc')
header.setAttribute('aria-label', 'sort by ' + header.innerHTML + ' in descending order')
} else if (ordering === -1) {
header.classList.remove('desc')
header.classList.add('asc')
header.setAttribute('aria-label', 'sort by ' + header.innerHTML + ' in ascending order')
}
}
thead.addEventListener(
'click',
event => {
let target = event.target
let type = target.dataset.type
if (target.nodeName.toLowerCase() === 'th') {
sort(target, target.cellIndex, type)
}
},
0
)
Also see: Tab Triggers