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="pagination">
<button class="backward" id="first">first</button>
<button class="backward" id="prev">previous</button>
<button class="forward" id="next">next</button>
<button class="forward" id="last">last</button>
<div class="page-numbers" id="pageNumbers"></div>
</div>
<div class="table-wrapper">
<table id="paginatedTable">
<thead>
<tr>
<th>name</th>
<th>code</th>
<th>emoji</th>
<th>category</th>
<th>cldr short name</th>
<th>alt names</th>
<th>emoji version</th>
<th>unicode version</th>
</tr>
</thead>
<tbody>
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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 class="hidden">
<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,.2), rgba(0,0,0,0)),
radial-gradient(farthest-side at 100% 50%, rgba(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;
}
th,
td {
text-align: left;
padding: 0.5em 1em;
white-space: nowrap;
}
.hidden {
display: none;
}
button {
font-size: inherit;
margin: 0 0.25em;
padding: 0.25em 0.5em;
background-color: #555;
color: #fff;
border: 0;
transition: background-color 0.4s, color 0.4s;
&:hover {
background-color: #bbb;
color: #000;
}
}
.pagination {
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 1em;
flex-wrap: wrap;
}
.page-numbers {
margin: 1em 1em 0;
}
.page-number {
padding: 0.5em;
opacity: 0.5;
cursor: pointer;
}
.active {
opacity: 1;
}
@media screen and (min-width: 540px) {
.backward {
order: 1;
}
.page-numbers {
order: 2;
margin-top: 0;
}
.forward {
order: 3;
}
}
let pageList = new Array()
let currentPage = 1
const numberPerPage = 12
const rows = Array.prototype.slice.call(document.querySelectorAll('tbody tr'))
const firstBtn = document.getElementById('first')
const lastBtn = document.getElementById('last')
const prevBtn = document.getElementById('prev')
const nextBtn = document.getElementById('next')
const numberOfPages = getNumberOfPages()
const pageNumbers = document.getElementById('pageNumbers')
firstBtn.addEventListener('click', firstPage, false)
lastBtn.addEventListener('click', lastPage, false)
prevBtn.addEventListener('click', prevPage, false)
nextBtn.addEventListener('click', nextPage, false)
window.onload = load(numberOfPages)
function getNumberOfPages() {
return Math.ceil(rows.length / numberPerPage)
}
function generatePageNumbers(pageCount) {
for (let j = 1; j <= pageCount; j++) {
const pageNumber = document.createElement('span')
pageNumber.innerHTML = j
pageNumber.classList.add('page-number')
pageNumbers.appendChild(pageNumber)
if (j === currentPage) {
pageNumber.classList.add('active')
}
pageNumber.addEventListener('click', jumpToPage, false)
}
}
function jumpToPage(event) {
currentPage = event.target.innerHTML
loadRows()
activePageNum(currentPage)
}
function activePageNum(activePage) {
const pageNumbers = Array.prototype.slice.call(document.querySelectorAll('.page-number'))
pageNumbers.forEach(function(pageNumber) {
if (parseInt(pageNumber.innerHTML) === activePage) {
pageNumber.classList.add('active')
} else {
pageNumber.classList.remove('active')
}
})
}
function nextPage() {
currentPage += 1
loadRows()
activePageNum(currentPage)
}
function prevPage() {
currentPage -= 1
loadRows()
activePageNum(currentPage)
}
function firstPage() {
currentPage = 1
loadRows()
activePageNum(currentPage)
}
function lastPage() {
currentPage = numberOfPages
loadRows()
activePageNum(currentPage)
}
function loadRows() {
const start = ((currentPage - 1) * numberPerPage)
const end = start + numberPerPage
for (let i = 0; i < pageList.length; i++) {
pageList[i].classList.add('hidden')
}
pageList = rows.slice(start, end)
drawRows()
buttonStates()
}
function drawRows() {
for (let i = 0; i < pageList.length; i++) {
pageList[i].classList.remove('hidden')
}
}
function buttonStates() {
document.getElementById('next').disabled = currentPage == numberOfPages ? true : false
document.getElementById('prev').disabled = currentPage == 1 ? true : false
document.getElementById('first').disabled = currentPage == 1 ? true : false
document.getElementById('last').disabled = currentPage == numberOfPages ? true : false
}
function load(pageCount) {
generatePageNumbers(numberOfPages)
loadRows()
}
Also see: Tab Triggers