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.
<div class="container">
<div class="row">
<div class="col-md-6">
<div class="flipcard">
<div class="flipcard-wrap">
<div class="card card-front">
<img src="https://static1.squarespace.com/static/57d9e959d482e972e8434364/t/5be79be9c2241bb5cb774bb4/1541905391787/shutterstock_633629336.jpg" alt="" class="card-img-top">
<div class="card-body">
<h5>medium flipcard</h5>
<p>a flipcard that's 1/2 width</p>
</div>
</div>
<div class="card card-back">
<div class="card-body">
Los Angeles is a sprawling Southern California city and the center of the nation’s film and television industry. Near its iconic Hollywood sign, studios such as Paramount Pictures, Universal and Warner Brothers offer behind-the-scenes tours. On Hollywood Boulevard, TCL Chinese Theatre displays celebrities’ hand- and footprints, the Walk of Fame honors thousands of luminaries and vendors sell maps to stars’ homes.
</div>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="flipcard">
<div class="flipcard-wrap">
<div class="card card-front">
<img src="https://static1.squarespace.com/static/57d9e959d482e972e8434364/t/5be79be9c2241bb5cb774bb4/1541905391787/shutterstock_633629336.jpg" alt="" class="card-img-top">
<div class="card-body">
<h5>skinny flipcard</h5>
<p>a flipcard that's 1/3 width</p>
</div>
</div>
<div class="card card-back">
<div class="card-body">
back stuff and thangs.
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="flipcard">
<div class="flipcard-wrap">
<div class="card card-front">
<img src="https://images.unsplash.com/photo-1503891450247-ee5f8ec46dc3?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80" alt="" class="card-img-top">
<div class="card-body">
<h5>portrait flipcard</h5>
<p>a flipcard that's 1/3 width with a portrait orientation</p>
</div>
</div>
<div class="card card-back">
<div class="card-body">
damn thats a tall photo.
</div>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="flipcard">
<div class="flipcard-wrap">
<div class="card card-front">
<img src="https://www.lacity.org/sites/g/files/wph1101/f/styles/isotope_tiles_full_tile__680x410_/public/bigstock-Los-Angeles-California-USA--230874199.jpg?itok=-Va9FP8a" alt="" class="card-img-top">
<div class="card-body">
<h5>long winded flipcard</h5>
<p>a flipcard that's 1/3 width with overflowing back text (long paragraph)</p>
</div>
</div>
<div class="card card-back">
<div class="card-body">
<p>Los Angeles is in a large basin bounded by the Pacific Ocean on one side and by mountains as high as 10,000 feet (3,000 m) on the others. The city proper, which covers about 469 square miles (1,210 km2) is the seat of Los Angeles County, the most populated county in the country. Los Angeles is also the principal city of the Los Angeles metropolitan area, the second largest in the United States after that of New York City, with a population of 13.1 million. It is part of the Los Angeles-Long Beach combined statistical area, also the nation's second most populous area with a 2015 estimated population of 18.7 million.</p>
<p>Los Angeles is one of the most substantial economic engines within the United States, with a diverse economy in a broad range of professional and cultural fields. Los Angeles is also famous as the home of Hollywood, a major center of the world entertainment industry. A global city, it has been ranked 6th in the Global Cities Index and 9th in the Global Economic Power Index. The Los Angeles combined statistical area also has a gross metropolitan product of $831 billion (as of 2008), making it the third-largest in the world, after the Tokyo and New York metropolitan areas. Los Angeles hosted the 1932 and 1984 Summer Olympics and will host the event for a third time in 2028. The city also hosted the Miss Universe pageant twice, in 1990 and 2006, and was one of 9 American cities to host the 1994 FIFA men's soccer World Cup and one of 8 to host the 1999 FIFA women's soccer World Cup, hosting the final match for both tournaments.</p>
<p>Historically home to the Chumash and Tongva, Los Angeles was claimed by Juan Rodríguez Cabrillo for Spain in 1542 along with the rest of what would become Alta California. The city was officially founded on September 4, 1781, by Spanish governor Felipe de Neve. It became a part of Mexico in 1821 following the Mexican War of Independence. In 1848, at the end of the Mexican–American War, Los Angeles and the rest of California were purchased as part of the Treaty of Guadalupe Hidalgo, becoming part of the United States. Los Angeles was incorporated as a municipality on April 4, 1850, five months before California achieved statehood. The discovery of oil in the 1890s brought rapid growth to the city. The completion of the Los Angeles Aqueduct in 1913, delivering water from Eastern California, later assured the city's continued rapid growth.</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
.container {
padding-top: 3rem;
padding-bottom: 5rem;
}
.flipcard {
perspective: 1000px;
margin-bottom: 1.5rem;
}
.flipcard .flipcard-wrap {
position: relative;
width: 100%;
height: 100%;
text-align: center;
transition: transform 0.6s;
transform-style: preserve-3d;
}
.flipcard .card-front,
.flipcard .card-back {
width: 100%;
height: 100%;
position: relative;
backface-visibility: hidden;
transition: all .3s;
}
.flipcard .card-front {
z-index: 2;
}
.flipcard .card-front::after {
content: "";
display: block;
width: 0;
position: absolute;
bottom: -1px;
right: -1px;
border-width: 16px 16px 0 0;
border-style: solid;
border-color: #999 #fff;
border-radius: .25rem 0 0 0;
}
.flipcard .card-back {
position: absolute;
top: 0;
text-align: left;
z-index: 1;
transform: rotateY(180deg);
overflow-y: auto;
}
/* the flippy magic */
.flipcard:hover .flipcard-wrap {
transform: rotateY(-180deg);
}
Also see: Tab Triggers