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.
<section class="aw-accordion">
<h1>Responsive Accordion Content
<a href="" class="read-article">Read Article</a></h1>
<div class="one">
<h1>Sport</h1>
<span><img src="http://lorempixel.com/150/150/sports">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum blandit augue at libero porta, eu euismod libero cursus. Aliquam id dui nec tortor sodales luctus. Aenean lobortis tortor euismod, malesuada sapien in, euismod ipsum. Maecenas blandit tortor purus, eu mattis libero ullamcorper eget. Phasellus in metus et velit euismod efficitur a non est. Quisque placerat egestas scelerisque. Morbi nec venenatis lectus. Vivamus vehicula velit eu venenatis vulputate. In hac habitasse platea dictumst. Duis nibh tellus, commodo vitae dapibus nec, blandit eu nibh. Nulla vel nunc a ipsum interdum hendrerit. Curabitur arcu lectus, scelerisque sit amet lectus a, cursus pretium nibh. Nunc a arcu efficitur, pharetra dui sed, sodales felis. Duis eget pulvinar libero, at aliquam dui. Donec quis nulla vitae leo volutpat sodales.</span>
</div>
<div class="two">
<h1>People</h1>
<span><img src="http://lorempixel.com/150/150/people">Lorem ipsum dolor sit amet, consectetur adipiscing elit.Morbi nec venenatis lectus. Vivamus vehicula velit eu venenatis vulputate. In hac habitasse platea dictumst. Duis nibh tellus, commodo vitae dapibus nec, blandit eu nibh.Morbi nec venenatis lectus.Morbi nec venenatis lectus. Vivamus vehicula velit eu venenatis vulputate. In hac habitasse platea dictumst. Duis nibh tellus, commodo vitae dapibus nec, blandit eu nibh.Morbi nec venenatis lectus. Vestibulum blandit augue at libero porta, eu euismod libero cursus. Aliquam id dui nec tortor sodales luctus. Aenean lobortis tortor euismod, malesuada sapien in, euismod ipsum. Maecenas blandit tortor purus, eu mattis libero ullamcorper eget. Phasellus in metus et velit euismod efficitur a non est. Quisque placerat egestas scelerisque. Morbi nec venenatis lectus. Vivamus vehicula velit eu venenatis vulputate. In hac habitasse platea dictumst. Duis nibh tellus, commodo vitae dapibus nec, blandit eu nibh. Nulla vel nunc a ipsum interdum hendrerit. Curabitur arcu lectus, scelerisque sit amet lectus a, cursus pretium nibh. Nunc a arcu efficitur, pharetra dui sed, sodales felis. Duis eget pulvinar libero, at aliquam dui. Donec quis nulla vitae leo volutpat sodales.</span>
</div>
<div class="three">
<h1>Nightlife</h1>
<span><img src="http://lorempixel.com/150/150/nightlife">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum blandit augue at libero porta, eu euismod libero cursus. Aliquam id dui nec tortor sodales luctus. Aenean lobortis tortor euismod, malesuada sapien in, euismod ipsum. Maecenas blandit tortor purus, eu mattis libero ullamcorper eget. Phasellus in metus et velit euismod efficitur a non est. Quisque placerat egestas scelerisque. Morbi nec venenatis lectus. Vivamus vehicula velit eu venenatis vulputate. In hac habitasse platea dictumst. Duis nibh tellus, commodo vitae dapibus nec, blandit eu nibh. Nulla vel nunc a ipsum interdum hendrerit. Curabitur arcu lectus, scelerisque sit amet lectus a, cursus pretium nibh. Nunc a arcu efficitur, pharetra dui sed, sodales felis. Duis eget pulvinar libero, at aliquam dui. Donec quis nulla vitae leo volutpat sodales.</span>
</div>
<div class="four">
<h1>Food</h1>
<span><img src="http://lorempixel.com/150/150/food">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum blandit augue at libero porta, eu euismod libero cursus. Aliquam id dui nec tortor sodales luctus. Aenean lobortis tortor euismod, malesuada sapien in, euismod ipsum. Maecenas blandit tortor purus, eu mattis libero ullamcorper eget. Phasellus in metus et velit euismod efficitur a non est. Quisque placerat egestas scelerisque. Morbi nec venenatis lectus. Vivamus vehicula velit eu venenatis vulputate. In hac habitasse platea dictumst. Duis nibh tellus, commodo vitae dapibus nec, blandit eu nibh.Morbi nec venenatis lectus. Vivamus vehicula velit eu venenatis vulputate. In hac habitasse platea dictumst. Duis nibh tellus, commodo vitae dapibus nec, blandit eu nibh.Morbi nec venenatis lectus. Vivamus vehicula velit eu venenatis vulputate. In hac habitasse platea dictumst. Duis nibh tellus, commodo vitae dapibus nec, blandit eu nibh.Morbi nec venenatis lectus.Morbi nec venenatis lectus. Vivamus vehicula velit eu venenatis vulputate. In hac habitasse platea dictumst. Duis nibh tellus, commodo vitae dapibus nec, blandit eu nibh.Morbi nec venenatis lectus.Morbi nec venenatis lectus. Vivamus vehicula velit eu venenatis vulputate. In hac habitasse platea dictumst. Duis nibh tellus, commodo vitae dapibus nec, blandit eu nibh.Morbi nec venenatis lectus. Vivamus vehicula velit eu venenatis vulputate. In hac habitasse platea dictumst. Duis nibh tellus, commodo vitae dapibus nec, blandit eu nibh.</span>
</div>
</section>
@import url(https://fonts.googleapis.com/css?family=Open+Sans:300,400&subset=latin,latin-ext);
body{
background:#34495e;
font-family:'Open Sans', sans-serif;
}
section.aw-accordion{
width:800px;
margin:40px auto;
margin-bottom:30px;
}
section.aw-accordion .one,
section.aw-accordion .two,
section.aw-accordion .three,
section.aw-accordion .four{
font-size:14px;
width:23%;
float:left;
height:230px;
display:inline-block;
z-index:1;
position:relative;
overflow:hidden;
padding:1%;
transition:all 200ms cubic-bezier(0.645, 0.575, 0.090, 1.000);
cursor: default;
}
section.aw-accordion .one span,
section.aw-accordion .two span,
section.aw-accordion .three span,
section.aw-accordion .four span{
background: -webkit-linear-gradient(left, rgba(255, 255, 255, .5), rgba(255, 255, 255, 0));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
height:100%;
display:table;
}
section.aw-accordion .one{
background-color:#3498db;
border-radius:10px 0 0 10px;
}
section.aw-accordion .two{
background-color:#e74c3c;
}
section.aw-accordion .three{
background-color:#1abc9c;
}
section.aw-accordion .four{
background-color:#f1c40f;
border-radius:0 10px 10px 0;
}
section.aw-accordion .one:hover,
section.aw-accordion .two:hover,
section.aw-accordion .three:hover,
section.aw-accordion .four:hover{
overflow-y: auto;
}
section.aw-accordion .one:hover span,
section.aw-accordion .two:hover span,
section.aw-accordion .three:hover span,
section.aw-accordion .four:hover span{
background: -webkit-linear-gradient(left, rgba(255, 255, 255, .7), rgba(255, 255, 255, .7));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
section.aw-accordion div::-webkit-scrollbar {
width: 12px;
}
section.aw-accordion div::-webkit-scrollbar-track {
background-color: rgba(1, 1, 1, .1);
}
section.aw-accordion div::-webkit-scrollbar-thumb {
background-color: rgba(1, 1, 1, .2);
}
section.aw-accordion div::-webkit-scrollbar-thumb:hover {
background-color: rgba(1, 1, 1, .3);
}
section.aw-accordion div img{
float:left;
margin:0 10px 0 0;
border:3px solid rgba(255, 255, 255, .2);
box-shadow:0 0 15px rgba(1, 1, 1, .1);
-webkit-box-shadow:0 0 15px rgba(1, 1, 1, .1);
-moz-box-shadow:0 0 15px rgba(1, 1, 1, .1);
width:150px;
}
section.aw-accordion div img,
section.aw-accordion div h1{
opacity:.3;
transition:all .3s
}
section.aw-accordion div:hover img,
section.aw-accordion div:hover h1{
opacity:1;
}
section.aw-accordion div h1{
margin:0 0 5px;
font-weight:300;
color:white;
}
@media (max-width:1024px){
section.aw-accordion .one,
section.aw-accordion .two,
section.aw-accordion .three,
section.aw-accordion .four{
font-size:12px;
}
section.aw-accordion div img{
width:80px;
}
section.aw-accordion div h1{
font-size:120%
}
}
@media (max-width:768px){
section.aw-accordion div img{
width:60px;
}
section.aw-accordion div h1{
font-size:100%
}
}
/* Styling Demo */
section.aw-accordion > h1{
color:#233445;
display:block;
width:100%;
}
section.aw-accordion > h1 > .read-article{
color:#233445;
border-radius:5px;
border:1px solid #233445;
padding:4px 8px;
text-decoration:none;
float:right;
text-align:center;
font-size:80%;
}
section.aw-accordion > h1 > .read-article:hover{
color:white;
border:1px solid white;
}
@media (max-width:768px){
section.aw-accordion{
width:100%;
}
section.aw-accordion h1{
font-size:80%;
letter-spacing:-1px;
}
}
$( "section.aw-accordion div" ).mouseover(function() {
$(this).css('width','50%');
$(this).siblings('div').css('width','14%');
});
Also see: Tab Triggers