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.
<link href='https://fonts.googleapis.com/css?family=Raleway:400,700|Merriweather' rel='stylesheet' type='text/css'>
<h1 style="font-family: 'Raleway', sans-serif;"> CSS3 hover<span id="hover"> effects/</span></h1>
<p style="font-family: sans-serif; color: #fff; padding-left: 10px;">An implementation of Alessio Atzeni's CSS3 effects. Please give credit to <a href="www.jacobstone.co.uk" style="color:#efefef; text-decoration: none;">www.jacobstone.co.uk</a> if you use my photography.</p>
<div id="all">
<div class="view view-first">
<img src="https://static1.squarespace.com/static/5aea79c52487fde9b8efd0b1/t/5bb6b38ce5e5f09147c1b8ab/1538700172787/empire-state.png" />
<div class="mask">
<h2>Empire State</h2>
<p>A cool description of some sort between these tags. I am so cool and awesomely awesome.</p>
<a href="#" class="info">Read More</a>
</div>
</div>
<div class="view view-second">
<img src="https://static1.squarespace.com/static/5aea79c52487fde9b8efd0b1/t/5bb6b38e4785d3a94fdb56b0/1538700175156/midtown.png" />
<div class="mask"></div>
<div class="content">
<h2>Midtown</h2>
<p>A description of some sort between these tags. I am so cool and awesomely awesome.</p>
<a href="#" class="info">Read More</a>
</div>
</div>
<div class="view view-tenth">
<img src="https://static1.squarespace.com/static/5aea79c52487fde9b8efd0b1/t/5bb6b388e5e5f09147c1b870/1538700168395/liberty.png" />
<div class="mask">
<h2>The Only Living Boy in New York</h2>
<p>Words and such, a whole lot more of muh flippin' words.</p>
<a href="#" class="info">Read More</a>
</div>
</div>
<div class="view view-second">
<img src="https://static1.squarespace.com/static/5aea79c52487fde9b8efd0b1/t/5bb6b392e5e5f09147c1b901/1538700178288/skyscrapers.png" />
<div class="mask"></div>
<div class="content">
<h2 id="testimonials">Skyscrapers</h2>
<p>“A description of some sort between these tags. I am so cool. Didn't you hear? ”</p>
<a href="#" class="info">Read More</a>
</div>
</div>
</div>
html {
min-height: 100%;
}
body {
background: radial-gradient(ellipse at bottom left, rgba(104, 128, 138, 0.4) 10%, rgba(138, 114, 76, 0) 40%), linear-gradient(to bottom, rgba(57, 173, 219, .25), rgba(42, 60, 87, 0.4)), linear-gradient(135deg, #670d10, #092756);
}
h1 {
color: white;
padding-left: 10px;
}
#hover {
color: rgba(188, 175, 204, 0.9);
}
h2#testimonials {
color: #fffae3;
}
div#all {
width: 100%;
height: 100%;
}
/* generic css */
.view {
margin: 10px;
float: left;
border: 10px solid #fff;
overflow: hidden;
position: relative;
text-align: center;
box-shadow: 1px 1px 2px #e6e6e6;
cursor: default;
background: #fff url(../images/bgimg.jpg) no-repeat center center
}
.view .mask,
.view .content {
width: 300px;
height: 200px;
position: absolute;
overflow: hidden;
top: 0;
left: 0
}
.view img {
display: block;
position: relative
}
.view h2 {
text-transform: uppercase;
color: #fff;
text-align: center;
position: relative;
font-size: 17px;
font-family: Raleway, serif;
padding: 10px;
/*background: rgba(0, 0, 0, 0.8);*/
margin: 20px 0 0 0
}
.view p {
font-family: Merriweather, serif;
font-style: italic;
font-size: 14px;
position: relative;
color: #fff;
padding: 0px 20px 0px;
text-align: center
}
.view a.info {
display: inline-block;
text-decoration: none;
padding: 7px 14px;
background: #000;
color: #fff;
font-family: Raleway, serif;
text-transform: uppercase;
box-shadow: 0 0 1px #000
}
.view a.info:hover {
box-shadow: 0 0 5px #000
}
/*1*/
.view-first img {
/*1*/
transition: all 0.2s linear;
width: 300px;
height: 200px;
}
.view-first .mask {
opacity: 0;
background-color: rgba(58, 1, 132, 0.44);
transition: all 0.4s ease-in-out;
}
.view-first h2 {
transform: translateY(-100px);
opacity: 0;
font-family: Raleway, serif;
transition: all 0.2s ease-in-out;
}
.view-first p {
transform: translateY(100px);
opacity: 0;
transition: all 0.2s linear;
}
.view-first a.info {
opacity: 0;
transition: all 0.2s ease-in-out;
}
/* */
.view-first:hover img {
transform: scale(1.1);
}
.view-first:hover .mask {
opacity: 1;
}
.view-first:hover h2,
.view-first:hover p,
.view-first:hover a.info {
opacity: 1;
transform: translateY(0px);
}
.view-first:hover p {
transition-delay: 0.1s;
}
.view-first:hover a.info {
transition-delay: 0.2s;
}
/*2*/
.view-second img {
transition: all 0.2s ease-in;
-webkit-transition: all 0.2s ease-in;
}
.view-second .mask {
background-color: rgba(12, 19, 27, 0.6);
width: 300px;
padding: 105px;
height: 200px;
opacity: 0;
transform: translate(265px, 145px) rotate(45deg);
-webkit-transform: translate(265px, 145px) rotate(45deg);
transition: all 0.2s ease-in-out;
-webkit-transition: all 0.2s ease-in-out;
}
.view-second h2 {
border-bottom: 1px solid rgba(0, 0, 0, 0.3);
font-family: Raleway, serif;
background: transparent;
margin: 20px 40px 0px 40px;
-webkit-transform: translate(200px, -200px);
transform: translate(200px, -200px);
-webkit-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}
.view-second p {
transform: translate(-200px, 200px);
-webkit-transform: translate(200px, -200px);
transition: all 0.2s ease-in-out;
-webkit-transition: all 0.2s ease-in-out;
}
.view-second a.info {
transform: translate(0px, 100px);
-webkit-transform: translate(0px, 100px);
transition: all 0.2s 0.1s ease-in-out;
-webkit-transition: all 0.2s 0.1s ease-in-out;
}
/* */
.view-second:hover .mask {
opacity: 1;
transform: translate(-80px, -125px) rotate(45deg);
-webkit-transform: translate(-80px, -125px) rotate(45deg);
}
.view-second:hover h2 {
transform: translate(0px, 0px);
-webkit-transform: translate(0px, 0px);
transition-delay: 0.3s;
-webkit-transition-delay: 0.3s;
}
.view-second:hover p {
transform: translate(0px, 0px);
-webkit-transform: translate(0px, 0px);
transition-delay: 0.4s;
-webkit-transition-delay: 0.4s;
}
.view-second:hover a.info {
transform: translate(0px, 0px);
-webkit-transform: translate(0px, 0px);
transition-delay: 0.5s;
-webkit-transition-delay: 0.5s;
}
/*3*/
.view-tenth img {
transform: scaleY(1);
transition: all .7s ease-in-out;
}
.view-tenth .mask {
background-color: rgba(255, 231, 179, 0.3);
transition: all 0.5s linear;
opacity: 0;
}
.view-tenth h2 {
border-bottom: 1px solid rgba(0, 0, 0, 0.3);
background: transparent;
margin: 20px 40px 0px 40px;
transform: scale(0);
color: #333;
transition: all 0.5s linear;
opacity: 0;
}
.view-tenth p {
color: #333;
opacity: 0;
transform: scale(0);
transition: all 0.5s linear;
padding-
}
.view-tenth a.info {
opacity: 0;
transform: scale(0);
transition: all 0.5s linear;
}
.view-tenth:hover img {
-webkit-transform: scale(10);
transform: scale(10);
opacity: 0;
}
.view-tenth:hover .mask {
opacity: 1;
}
.view-tenth:hover h2,
.view-tenth:hover p,
.view-tenth:hover a.info {
transform: scale(1);
opacity: 1;
}
Also see: Tab Triggers