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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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.
<div class="Contents">
<div class="Contents_block">
<div class="Tabs">
<ul class="Tabs-menu jsc-Tabs-menu">
<li class="Tabs-menu_unit jsc-Tabs-menu_unit -active">
<a href="#" class="Tabs-menu_element">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="Tabs-menu__icon" width="60" height="60"><path d="M370.214 205.502l-10.831-14.441V44.308C359.384 19.876 339.507 0 315.076 0s-44.308 19.876-44.308 44.308v78.769H241.23V44.308C241.23 19.876 221.353 0 196.922 0s-44.308 19.876-44.308 44.308v146.754l-10.831 14.441c-8.435 11.247-13.082 25.185-13.082 39.244.001 30.777 21.375 56.642 50.054 63.57.397.096.796.188 1.195.277.48.106.958.215 1.442.31a56.925 56.925 0 0 0 3.445.582c.665.096 1.333.18 2.005.255.253.029.504.063.758.088a63.575 63.575 0 0 0 3.553.25c.981.044 1.965.075 2.957.075h123.781c.992 0 1.976-.031 2.957-.075.259-.012.519-.024.777-.038.93-.053 1.857-.12 2.776-.212.254-.026.504-.06.757-.088.672-.075 1.34-.16 2.005-.256.391-.056.782-.112 1.17-.174a63.175 63.175 0 0 0 2.274-.408c.483-.096.962-.204 1.441-.31.4-.089.798-.18 1.195-.277 28.679-6.928 50.053-32.792 50.053-63.57 0-14.059-4.646-27.997-13.082-39.244zm-129.051 12.571c-.049.473-.128.955-.217 1.428-.099.473-.217.945-.354 1.408-.147.453-.305.916-.492 1.359-.186.443-.393.876-.62 1.3-.225.433-.472.847-.738 1.25-.266.394-.551.788-.857 1.162s-.639.738-.975 1.083c-.345.335-.709.67-1.083.975s-.768.591-1.162.857a14.25 14.25 0 0 1-2.55 1.358 14.1 14.1 0 0 1-1.36.492c-.463.138-.934.256-1.408.354-.472.089-.955.167-1.428.217-.482.049-.975.069-1.457.069s-.975-.02-1.457-.069a17.66 17.66 0 0 1-1.428-.217 17.565 17.565 0 0 1-1.408-.354 14.082 14.082 0 0 1-1.359-.492 17.826 17.826 0 0 1-1.3-.61 14.533 14.533 0 0 1-1.25-.748 15.779 15.779 0 0 1-1.162-.857 17 17 0 0 1-1.084-.975c-.335-.345-.67-.709-.975-1.083s-.591-.768-.856-1.162a14.39 14.39 0 0 1-.749-1.25 19.285 19.285 0 0 1-.61-1.3 17.383 17.383 0 0 1-.492-1.359 16.651 16.651 0 0 1-.353-1.408 18.523 18.523 0 0 1-.218-1.428 14.498 14.498 0 0 1-.068-1.457c0-.482.02-.975.068-1.457.05-.473.129-.955.218-1.428.098-.473.217-.945.353-1.408a17.8 17.8 0 0 1 .492-1.359c.187-.443.394-.876.61-1.3.226-.433.482-.847.749-1.25.266-.394.551-.788.856-1.162.306-.374.64-.738.975-1.083a17 17 0 0 1 1.084-.975 14.289 14.289 0 0 1 2.412-1.595 14.51 14.51 0 0 1 1.3-.62c.443-.187.906-.345 1.359-.492.463-.138.935-.256 1.408-.354.473-.089.956-.167 1.428-.217.965-.089 1.95-.089 2.914 0 .473.049.956.128 1.428.217.473.098.945.217 1.408.354.453.148.917.305 1.36.492.442.187.885.394 1.299.62.433.226.847.473 1.251.738.393.266.788.551 1.162.857s.738.64 1.083.975c.336.345.671.709.975 1.083.306.374.592.768.857 1.162.267.404.513.817.738 1.25.226.423.433.857.62 1.3.187.443.346.906.492 1.359.139.463.256.935.354 1.408.089.473.167.955.217 1.428.049.482.069.975.069 1.457 0 .482-.021.974-.069 1.457zm59.068-.01c-.039.482-.118.965-.217 1.438-.09.473-.207.945-.346 1.408-.147.453-.305.916-.492 1.359-.186.443-.393.876-.62 1.3-.226.433-.472.847-.738 1.25-.266.404-.561.788-.857 1.162-.314.374-.639.738-.975 1.083a17.29 17.29 0 0 1-1.083.975 14.16 14.16 0 0 1-2.413 1.595c-.423.226-.857.433-1.299.62-.443.187-.907.345-1.36.492-.463.138-.934.256-1.408.354-.472.089-.955.167-1.428.217-.482.049-.975.069-1.457.069-.482 0-.975-.02-1.457-.069a17.66 17.66 0 0 1-1.428-.217 16.33 16.33 0 0 1-1.398-.354 16.364 16.364 0 0 1-1.369-.492 15.948 15.948 0 0 1-1.3-.62 14.697 14.697 0 0 1-1.25-.738 15.779 15.779 0 0 1-1.162-.857 17 17 0 0 1-1.084-.975c-.335-.345-.669-.709-.975-1.083s-.591-.758-.856-1.162a17.065 17.065 0 0 1-.749-1.25 19.285 19.285 0 0 1-.61-1.3 17.383 17.383 0 0 1-.492-1.359 16.651 16.651 0 0 1-.353-1.408 18.055 18.055 0 0 1-.218-1.438 14.178 14.178 0 0 1-.068-1.447c0-.482.02-.975.068-1.457.05-.473.129-.955.218-1.428.099-.473.217-.945.354-1.408a17.8 17.8 0 0 1 .492-1.359c.187-.443.394-.876.61-1.3.236-.433.482-.847.749-1.25.266-.394.551-.788.856-1.162.306-.374.64-.738.975-1.083a17 17 0 0 1 1.084-.975 14.289 14.289 0 0 1 2.412-1.595c.424-.226.857-.433 1.3-.62.443-.187.906-.345 1.369-.492.453-.138.926-.256 1.398-.354.473-.089.956-.167 1.428-.217.965-.089 1.95-.089 2.914 0 .473.049.956.128 1.428.217.473.098.945.217 1.408.354.453.148.917.305 1.36.492.442.187.876.394 1.299.62.433.226.847.473 1.251.738.393.266.788.551 1.162.857.374.305.738.64 1.083.975.336.345.661.709.975 1.083.295.374.592.768.857 1.162.267.404.513.817.738 1.25.226.423.433.857.62 1.3.187.443.346.906.492 1.359.139.463.256.935.346 1.408.099.473.177.955.217 1.428.049.482.079.975.079 1.457-.001.482-.031.974-.08 1.447zM360.742 329.456c-12.882 6.543-27.443 10.236-42.852 10.236H194.11c-15.409 0-29.971-3.693-42.851-10.236-30.575 28.965-47.874 68.931-47.874 111.531a70.567 70.567 0 0 0 6.12 28.841C120.891 495.447 146.363 512 174.397 512h27.449v-78.769c0-8.157 6.613-14.769 14.769-14.769 8.157 0 14.769 6.613 14.769 14.769V512h49.231v-78.769c0-8.157 6.613-14.769 14.769-14.769 8.156 0 14.769 6.613 14.769 14.769V512h27.449c28.034 0 53.506-16.553 64.892-42.172a70.55 70.55 0 0 0 6.12-28.841c.001-42.6-17.297-82.565-47.872-111.531z"/></svg>
</a>
</li>
<li class="Tabs-menu_unit jsc-Tabs-menu_unit">
<a href="#" class="Tabs-menu_element">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="Tabs-menu__icon" width="60" height="60"><path d="M370.214 205.502l-10.831-14.441V44.308C359.384 19.876 339.507 0 315.076 0s-44.308 19.876-44.308 44.308v78.769H241.23V44.308C241.23 19.876 221.353 0 196.922 0s-44.308 19.876-44.308 44.308v146.754l-10.831 14.441c-8.435 11.247-13.082 25.185-13.082 39.244.001 30.777 21.375 56.642 50.054 63.57.397.096.796.188 1.195.277.48.106.958.215 1.442.31a56.925 56.925 0 0 0 3.445.582c.665.096 1.333.18 2.005.255.253.029.504.063.758.088a63.575 63.575 0 0 0 3.553.25c.981.044 1.965.075 2.957.075h123.781c.992 0 1.976-.031 2.957-.075.259-.012.519-.024.777-.038.93-.053 1.857-.12 2.776-.212.254-.026.504-.06.757-.088.672-.075 1.34-.16 2.005-.256.391-.056.782-.112 1.17-.174a63.175 63.175 0 0 0 2.274-.408c.483-.096.962-.204 1.441-.31.4-.089.798-.18 1.195-.277 28.679-6.928 50.053-32.792 50.053-63.57 0-14.059-4.646-27.997-13.082-39.244zm-129.051 12.571c-.049.473-.128.955-.217 1.428-.099.473-.217.945-.354 1.408-.147.453-.305.916-.492 1.359-.186.443-.393.876-.62 1.3-.225.433-.472.847-.738 1.25-.266.394-.551.788-.857 1.162s-.639.738-.975 1.083c-.345.335-.709.67-1.083.975s-.768.591-1.162.857a14.25 14.25 0 0 1-2.55 1.358 14.1 14.1 0 0 1-1.36.492c-.463.138-.934.256-1.408.354-.472.089-.955.167-1.428.217-.482.049-.975.069-1.457.069s-.975-.02-1.457-.069a17.66 17.66 0 0 1-1.428-.217 17.565 17.565 0 0 1-1.408-.354 14.082 14.082 0 0 1-1.359-.492 17.826 17.826 0 0 1-1.3-.61 14.533 14.533 0 0 1-1.25-.748 15.779 15.779 0 0 1-1.162-.857 17 17 0 0 1-1.084-.975c-.335-.345-.67-.709-.975-1.083s-.591-.768-.856-1.162a14.39 14.39 0 0 1-.749-1.25 19.285 19.285 0 0 1-.61-1.3 17.383 17.383 0 0 1-.492-1.359 16.651 16.651 0 0 1-.353-1.408 18.523 18.523 0 0 1-.218-1.428 14.498 14.498 0 0 1-.068-1.457c0-.482.02-.975.068-1.457.05-.473.129-.955.218-1.428.098-.473.217-.945.353-1.408a17.8 17.8 0 0 1 .492-1.359c.187-.443.394-.876.61-1.3.226-.433.482-.847.749-1.25.266-.394.551-.788.856-1.162.306-.374.64-.738.975-1.083a17 17 0 0 1 1.084-.975 14.289 14.289 0 0 1 2.412-1.595 14.51 14.51 0 0 1 1.3-.62c.443-.187.906-.345 1.359-.492.463-.138.935-.256 1.408-.354.473-.089.956-.167 1.428-.217.965-.089 1.95-.089 2.914 0 .473.049.956.128 1.428.217.473.098.945.217 1.408.354.453.148.917.305 1.36.492.442.187.885.394 1.299.62.433.226.847.473 1.251.738.393.266.788.551 1.162.857s.738.64 1.083.975c.336.345.671.709.975 1.083.306.374.592.768.857 1.162.267.404.513.817.738 1.25.226.423.433.857.62 1.3.187.443.346.906.492 1.359.139.463.256.935.354 1.408.089.473.167.955.217 1.428.049.482.069.975.069 1.457 0 .482-.021.974-.069 1.457zm59.068-.01c-.039.482-.118.965-.217 1.438-.09.473-.207.945-.346 1.408-.147.453-.305.916-.492 1.359-.186.443-.393.876-.62 1.3-.226.433-.472.847-.738 1.25-.266.404-.561.788-.857 1.162-.314.374-.639.738-.975 1.083a17.29 17.29 0 0 1-1.083.975 14.16 14.16 0 0 1-2.413 1.595c-.423.226-.857.433-1.299.62-.443.187-.907.345-1.36.492-.463.138-.934.256-1.408.354-.472.089-.955.167-1.428.217-.482.049-.975.069-1.457.069-.482 0-.975-.02-1.457-.069a17.66 17.66 0 0 1-1.428-.217 16.33 16.33 0 0 1-1.398-.354 16.364 16.364 0 0 1-1.369-.492 15.948 15.948 0 0 1-1.3-.62 14.697 14.697 0 0 1-1.25-.738 15.779 15.779 0 0 1-1.162-.857 17 17 0 0 1-1.084-.975c-.335-.345-.669-.709-.975-1.083s-.591-.758-.856-1.162a17.065 17.065 0 0 1-.749-1.25 19.285 19.285 0 0 1-.61-1.3 17.383 17.383 0 0 1-.492-1.359 16.651 16.651 0 0 1-.353-1.408 18.055 18.055 0 0 1-.218-1.438 14.178 14.178 0 0 1-.068-1.447c0-.482.02-.975.068-1.457.05-.473.129-.955.218-1.428.099-.473.217-.945.354-1.408a17.8 17.8 0 0 1 .492-1.359c.187-.443.394-.876.61-1.3.236-.433.482-.847.749-1.25.266-.394.551-.788.856-1.162.306-.374.64-.738.975-1.083a17 17 0 0 1 1.084-.975 14.289 14.289 0 0 1 2.412-1.595c.424-.226.857-.433 1.3-.62.443-.187.906-.345 1.369-.492.453-.138.926-.256 1.398-.354.473-.089.956-.167 1.428-.217.965-.089 1.95-.089 2.914 0 .473.049.956.128 1.428.217.473.098.945.217 1.408.354.453.148.917.305 1.36.492.442.187.876.394 1.299.62.433.226.847.473 1.251.738.393.266.788.551 1.162.857.374.305.738.64 1.083.975.336.345.661.709.975 1.083.295.374.592.768.857 1.162.267.404.513.817.738 1.25.226.423.433.857.62 1.3.187.443.346.906.492 1.359.139.463.256.935.346 1.408.099.473.177.955.217 1.428.049.482.079.975.079 1.457-.001.482-.031.974-.08 1.447zM360.742 329.456c-12.882 6.543-27.443 10.236-42.852 10.236H194.11c-15.409 0-29.971-3.693-42.851-10.236-30.575 28.965-47.874 68.931-47.874 111.531a70.567 70.567 0 0 0 6.12 28.841C120.891 495.447 146.363 512 174.397 512h27.449v-78.769c0-8.157 6.613-14.769 14.769-14.769 8.157 0 14.769 6.613 14.769 14.769V512h49.231v-78.769c0-8.157 6.613-14.769 14.769-14.769 8.156 0 14.769 6.613 14.769 14.769V512h27.449c28.034 0 53.506-16.553 64.892-42.172a70.55 70.55 0 0 0 6.12-28.841c.001-42.6-17.297-82.565-47.872-111.531z"/></svg>
</a>
</li>
<li class="Tabs-menu_unit jsc-Tabs-menu_unit">
<a href="#" class="Tabs-menu_element">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="Tabs-menu__icon" width="60" height="60"><path d="M370.214 205.502l-10.831-14.441V44.308C359.384 19.876 339.507 0 315.076 0s-44.308 19.876-44.308 44.308v78.769H241.23V44.308C241.23 19.876 221.353 0 196.922 0s-44.308 19.876-44.308 44.308v146.754l-10.831 14.441c-8.435 11.247-13.082 25.185-13.082 39.244.001 30.777 21.375 56.642 50.054 63.57.397.096.796.188 1.195.277.48.106.958.215 1.442.31a56.925 56.925 0 0 0 3.445.582c.665.096 1.333.18 2.005.255.253.029.504.063.758.088a63.575 63.575 0 0 0 3.553.25c.981.044 1.965.075 2.957.075h123.781c.992 0 1.976-.031 2.957-.075.259-.012.519-.024.777-.038.93-.053 1.857-.12 2.776-.212.254-.026.504-.06.757-.088.672-.075 1.34-.16 2.005-.256.391-.056.782-.112 1.17-.174a63.175 63.175 0 0 0 2.274-.408c.483-.096.962-.204 1.441-.31.4-.089.798-.18 1.195-.277 28.679-6.928 50.053-32.792 50.053-63.57 0-14.059-4.646-27.997-13.082-39.244zm-129.051 12.571c-.049.473-.128.955-.217 1.428-.099.473-.217.945-.354 1.408-.147.453-.305.916-.492 1.359-.186.443-.393.876-.62 1.3-.225.433-.472.847-.738 1.25-.266.394-.551.788-.857 1.162s-.639.738-.975 1.083c-.345.335-.709.67-1.083.975s-.768.591-1.162.857a14.25 14.25 0 0 1-2.55 1.358 14.1 14.1 0 0 1-1.36.492c-.463.138-.934.256-1.408.354-.472.089-.955.167-1.428.217-.482.049-.975.069-1.457.069s-.975-.02-1.457-.069a17.66 17.66 0 0 1-1.428-.217 17.565 17.565 0 0 1-1.408-.354 14.082 14.082 0 0 1-1.359-.492 17.826 17.826 0 0 1-1.3-.61 14.533 14.533 0 0 1-1.25-.748 15.779 15.779 0 0 1-1.162-.857 17 17 0 0 1-1.084-.975c-.335-.345-.67-.709-.975-1.083s-.591-.768-.856-1.162a14.39 14.39 0 0 1-.749-1.25 19.285 19.285 0 0 1-.61-1.3 17.383 17.383 0 0 1-.492-1.359 16.651 16.651 0 0 1-.353-1.408 18.523 18.523 0 0 1-.218-1.428 14.498 14.498 0 0 1-.068-1.457c0-.482.02-.975.068-1.457.05-.473.129-.955.218-1.428.098-.473.217-.945.353-1.408a17.8 17.8 0 0 1 .492-1.359c.187-.443.394-.876.61-1.3.226-.433.482-.847.749-1.25.266-.394.551-.788.856-1.162.306-.374.64-.738.975-1.083a17 17 0 0 1 1.084-.975 14.289 14.289 0 0 1 2.412-1.595 14.51 14.51 0 0 1 1.3-.62c.443-.187.906-.345 1.359-.492.463-.138.935-.256 1.408-.354.473-.089.956-.167 1.428-.217.965-.089 1.95-.089 2.914 0 .473.049.956.128 1.428.217.473.098.945.217 1.408.354.453.148.917.305 1.36.492.442.187.885.394 1.299.62.433.226.847.473 1.251.738.393.266.788.551 1.162.857s.738.64 1.083.975c.336.345.671.709.975 1.083.306.374.592.768.857 1.162.267.404.513.817.738 1.25.226.423.433.857.62 1.3.187.443.346.906.492 1.359.139.463.256.935.354 1.408.089.473.167.955.217 1.428.049.482.069.975.069 1.457 0 .482-.021.974-.069 1.457zm59.068-.01c-.039.482-.118.965-.217 1.438-.09.473-.207.945-.346 1.408-.147.453-.305.916-.492 1.359-.186.443-.393.876-.62 1.3-.226.433-.472.847-.738 1.25-.266.404-.561.788-.857 1.162-.314.374-.639.738-.975 1.083a17.29 17.29 0 0 1-1.083.975 14.16 14.16 0 0 1-2.413 1.595c-.423.226-.857.433-1.299.62-.443.187-.907.345-1.36.492-.463.138-.934.256-1.408.354-.472.089-.955.167-1.428.217-.482.049-.975.069-1.457.069-.482 0-.975-.02-1.457-.069a17.66 17.66 0 0 1-1.428-.217 16.33 16.33 0 0 1-1.398-.354 16.364 16.364 0 0 1-1.369-.492 15.948 15.948 0 0 1-1.3-.62 14.697 14.697 0 0 1-1.25-.738 15.779 15.779 0 0 1-1.162-.857 17 17 0 0 1-1.084-.975c-.335-.345-.669-.709-.975-1.083s-.591-.758-.856-1.162a17.065 17.065 0 0 1-.749-1.25 19.285 19.285 0 0 1-.61-1.3 17.383 17.383 0 0 1-.492-1.359 16.651 16.651 0 0 1-.353-1.408 18.055 18.055 0 0 1-.218-1.438 14.178 14.178 0 0 1-.068-1.447c0-.482.02-.975.068-1.457.05-.473.129-.955.218-1.428.099-.473.217-.945.354-1.408a17.8 17.8 0 0 1 .492-1.359c.187-.443.394-.876.61-1.3.236-.433.482-.847.749-1.25.266-.394.551-.788.856-1.162.306-.374.64-.738.975-1.083a17 17 0 0 1 1.084-.975 14.289 14.289 0 0 1 2.412-1.595c.424-.226.857-.433 1.3-.62.443-.187.906-.345 1.369-.492.453-.138.926-.256 1.398-.354.473-.089.956-.167 1.428-.217.965-.089 1.95-.089 2.914 0 .473.049.956.128 1.428.217.473.098.945.217 1.408.354.453.148.917.305 1.36.492.442.187.876.394 1.299.62.433.226.847.473 1.251.738.393.266.788.551 1.162.857.374.305.738.64 1.083.975.336.345.661.709.975 1.083.295.374.592.768.857 1.162.267.404.513.817.738 1.25.226.423.433.857.62 1.3.187.443.346.906.492 1.359.139.463.256.935.346 1.408.099.473.177.955.217 1.428.049.482.079.975.079 1.457-.001.482-.031.974-.08 1.447zM360.742 329.456c-12.882 6.543-27.443 10.236-42.852 10.236H194.11c-15.409 0-29.971-3.693-42.851-10.236-30.575 28.965-47.874 68.931-47.874 111.531a70.567 70.567 0 0 0 6.12 28.841C120.891 495.447 146.363 512 174.397 512h27.449v-78.769c0-8.157 6.613-14.769 14.769-14.769 8.157 0 14.769 6.613 14.769 14.769V512h49.231v-78.769c0-8.157 6.613-14.769 14.769-14.769 8.156 0 14.769 6.613 14.769 14.769V512h27.449c28.034 0 53.506-16.553 64.892-42.172a70.55 70.55 0 0 0 6.12-28.841c.001-42.6-17.297-82.565-47.872-111.531z"/></svg>
</a>
</li>
</ul>
<div class="Tabs-content jsc-Tabs-content">
<div class="Tabs-content_unit jsc-Tabs-content_unit -active">
<h1 class="Tabs-content__head">さんぷる</h1>
<p class="Tabs-content__text">うさちゃんがかわいいタブ切り替えです。</p>
</div>
<div class="Tabs-content_unit jsc-Tabs-content_unit">
<h1 class="Tabs-content__head">さんぷる</h1>
<p class="Tabs-content__text">これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。</p>
<p class="Tabs-content__text">これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。</p>
<p class="Tabs-content__text">これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。これはだみーてきすとです。</p>
</div>
<div class="Tabs-content_unit jsc-Tabs-content_unit">
<h1 class="Tabs-content__head">さんくす</h1>
<dl class="Tabs-content__list">
<div class="Tabs-content__list_block">
<dt class="Tabs-content__list-title">あいこん:</dt>
<dd class="Tabs-content__list-description"><a href="https://www.flaticon.com/free-icon/rabbit_742411#term=rabbit&page=3&position=29" target="_blank" class="Tabs-content__anchor">www.flaticon.com</a></dd>
</div>
<div class="Tabs-content__list_block">
<dt class="Tabs-content__list-title">からー:</dt>
<dd class="Tabs-content__list-description"><a href="https://colorhunt.co/palette/105443" target="_blank" class="Tabs-content__anchor">colorhunt.co</a></dd>
</div>
<div class="Tabs-content__list_block">
<dt class="Tabs-content__list-title">ふぉんと:</dt>
<dd class="Tabs-content__list-description"><a href="https://googlefonts.github.io/japanese/#mplus1p" target="_blank" class="Tabs-content__anchor">googlefonts.github.io</a></dd>
</div>
</dl>
</div>
</div>
</div>
</div>
</div>
$breakpoint-pc: 376px;
$breakpoint-sp: 375px;
@mixin mediaquery-pc {
@media screen and (min-width: ($breakpoint-pc)) {
@content;
}
}
@mixin mediaquery-sp {
@media screen and (max-width: ($breakpoint-sp)) {
@content;
}
}
$color1: #FFC7C7;
$color2: #FFE2E2;
$color3: #F6F6F6;
$color4: #8785A2;
//////////////////////////////////////////////////
body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
* {
box-sizing: border-box;
}
::selection {
background-color: rgba($color2, 0.3);
color: $color1;
}
::-moz-selection {
background-color: rgba($color2, 0.3);
color: $color1;
}
//////////////////////////////////////////////////
.Contents {
display: table;
width: 100%;
height: 100vh;
font-family: "Mplus 1p";
font-weight: 300;
@include mediaquery-pc {
font-size: 15px;
}
@include mediaquery-sp {
font-size: 12px;
}
color: $color4;
background-color: $color2;
}
.Contents_block {
display: table-cell;
vertical-align: middle;
}
.Tabs {
width: calc( ( 9 / 12 ) * 100% );
max-width: 1080px;
margin: 0 auto;
}
.Tabs-menu {
display: flex;
}
.Tabs-menu_unit {
transform: translateY(50%);
transition: transform 0.1s ease-in-out;
&.-active {
transform: translateY(0);
}
@include mediaquery-pc {
&:hover {
transform: translateY(0);
}
&.-active {
.Tabs-menu_element {
cursor: default;
}
}
}
}
.Tabs-menu_element {
display: block;
}
.Tabs-menu__icon {
vertical-align: bottom;
fill: $color3;
}
.Tabs-content {
height: 50vh;
max-height: 360px;
position: relative;
}
.Tabs-content_unit {
display: none;
width: 100%;
height: 100%;
position: absolute;
@include mediaquery-pc {
padding: 30px;
}
@include mediaquery-sp {
padding: 20px;
-webkit-overflow-scrolling: touch;
}
overflow-y: auto;
background-color: $color3;
border-radius: 10px;
&.-active {
display: block;
}
}
.Tabs-content__head {
@include mediaquery-pc {
font-size: 30px;
}
@include mediaquery-sp {
font-size: 24px;
}
}
.Tabs-content__text,
.Tabs-content__list {
margin-top: 20px;
line-height: 2;
}
.Tabs-content__list_block {
display: flex;
}
.Tabs-content__anchor {
text-decoration: none;
color: inherit;
background-color: $color2;
@include mediaquery-pc {
&:hover {
background-color: rgba($color2, 0.7);
}
}
}
var SHIROMI = SHIROMI || {};
SHIROMI.SAMPLE_CODE = {};
SHIROMI.SAMPLE_CODE.TABS = {
ACTIVE_CLASS: '-active',
init: function(){
this.setParameters();
this.bindEvent();
},
setParameters: function(){
this.$triggers = $('.jsc-Tabs-menu').find('.jsc-Tabs-menu_unit');
this.$reacts = $('.jsc-Tabs-content').find('.jsc-Tabs-content_unit');
},
bindEvent: function(){
var myself = this;
this.$triggers.each(function(index){
$(this).on('click', function(event){
event.preventDefault();
myself.toggleReactDisplay($(this), index);
});
});
},
toggleReactDisplay: function($trigger, index){
this.$triggers.removeClass(this.ACTIVE_CLASS);
this.$reacts.removeClass(this.ACTIVE_CLASS);
$trigger.addClass(this.ACTIVE_CLASS);
this.$reacts.eq(index).addClass(this.ACTIVE_CLASS);
}
};
$(function(){
SHIROMI.SAMPLE_CODE.TABS.init();
});
Also see: Tab Triggers