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 class="magazine">
<section class="text-center magazine-photo">
<div class="magazine-photo__wrapper">
<h2 class="text-lowercase magazine-photo__title">
A Different <span class="text-uppercase">Perspective</span>
</h2>
<hr class="magazine-photo__line" />
<p class="text-lowercase magazine-photo__desc">
A codepen by <span class="text-uppercase">Raisa Yang</span>
</p>
</div>
</section>
<section class="magazine-content">
<article class="magazine-article">
<header class="text-center magazine-article__header">
<h1 class="text-lowercase magazine-article__title">
A <span class="text-uppercase">Digital</span> Philosophy
</h1>
</header>
<div class="magazine-article__image">
<img src="http://raiscake.me/files/fashion-img.jpg" width="200" height="300" alt="Woman looking over her shoulder" />
</div>
<div class="magazine-article__body">
<h2 class="text-center text-uppercase magazine-article__body-title">Interview!</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec pellentesque nisi massa, sit amet blandit magna aliquam vel. Maecenas sit amet risus nec odio semper commodo nec id massa. Nam posuere lectus eu aliquet varius. Aenean vestibulum tellus non ornare pretium.
</p>
<p>
<strong>Nullam nibh massa, commodo non pulvinar quis, lacinia quis lacus?</strong>
Pellentesque sit amet quam consequat, dignissim urna vel, sodales quam. Donec maximus interdum porta. Quisque tincidunt commodo mi. Nunc id enim a odio dapibus malesuada vitae sed ipsum. Donec vestibulum non dolor ut suscipit. Nam ut ultricies ex. Etiam lacus odio, bibendum ac dictum ac, gravida id nibh. Pellentesque faucibus commodo sodales.
</p>
<p>
<strong>Pellentesque eu maximus elit. Mauris suscipit sed nulla nec tincidunt?</strong>
Praesent elementum viverra porttitor. Donec placerat at odio sit amet cursus. Mauris at sem ex. Fusce sed pharetra mauris, sed placerat eros. Pellentesque congue nibh vel laoreet vulputate. In sagittis ante in tincidunt efficitur.
<p>
<p>
<strong>Integer ac sodales ex. Curabitur cursus, odio ac gravida fermentum, ligula leo blandit urna, eu posuere sem ex luctus libero?</strong>
Mauris tincidunt odio eu quam cursus, a lobortis lectus fermentum. Nullam purus justo, accumsan et lacus eget, porttitor viverra ante. Quisque bibendum eu leo a porttitor. Cras sit amet mauris vel tellus pharetra semper id quis lectus. Duis euismod ligula lectus, sit amet porttitor eros ornare eget. Fusce congue tristique rhoncus. Suspendisse enim risus, tincidunt sed dictum at, vulputate nec nulla. Donec iaculis porttitor auctor. Ut id sagittis urna. Morbi urna dolor, hendrerit dictum porta sit amet, ultrices at est. Duis commodo condimentum egestas.
</p>
<p>
<strong>Mauris a molestie sapien. Aenean tincidunt, enim maximus vehicula dapibus, nisi tortor auctor justo, quis iaculis est quam ac diam?</strong>
Nunc feugiat urna arcu, eu varius urna varius at. Nunc libero mi, posuere quis est et, pretium egestas metus. Duis mauris risus, auctor nec mattis at, tempor eu augue. Vivamus a felis enim. Integer at erat sit amet orci gravida congue in ac erat. Vestibulum bibendum consequat diam.</p>
<p>
<strong>Vivamus vulputate urna in egestas aliquet. Nam faucibus viverra erat, vel lobortis erat mollis sed.</strong>
Donec vitae rutrum enim. Integer lacinia risus ut diam elementum, non hendrerit lectus sagittis. Aenean nec porta est. Aliquam eu sollicitudin ex. Pellentesque ornare malesuada erat in iaculis. Mauris vitae sollicitudin ante. Curabitur mauris neque, tincidunt sed faucibus id, mollis vitae purus. Cras eget consectetur lectus. Donec ac sem mattis, dictum nibh nec, pellentesque tortor. In non ullamcorper felis. Cras euismod porta ante sit amet congue. Aliquam varius fermentum imperdiet. Aenean ullamcorper tempor justo quis maximus. Suspendisse volutpat id est at fringilla.
</p>
</div>
</article>
<div class="magazine-credits">
<p>
<strong>Inspiration:</strong> <a href="http://www.touchey.com/post/15395830073/10-awesome-fashion-magazines-layouts" target="_blank">touchey.com</a>
</p>
<p>
<strong>Images used:</strong> <a href="https://www.pexels.com/photo/adult-attractive-beautiful-beauty-262226/" target="_blank">1</a> and <a href="https://www.pexels.com/photo/adult-art-beautiful-black-and-white-292532/">2</a>
</p>
</div>
<div class="trapezoid"></div>
</section>
</main>
/* Variables */
$xxs: 415px;
$xs: 620px;
$sm: 768px;
$md: 992px;
$lg: 1240px;
$xlg: 1500px;
$font-size-base: 14px;
$line-height-base: 2;
$serif-font: 'Playfair Display', 'Times New Roman', serif;
$sans-serif-font: 'Droid Sans', 'Arial', sans-serif;
$accent-font: 'Oswald', $sans-serif-font;
$black: #000;
$gray: #666;
$white: #FFF;
$pink: #CF8699;
/* Mixins */
@mixin min($width) {
@media screen and (min-width: $width) {
@content;
}
}
@mixin max($width) {
@media screen and (max-width: $width) {
@content;
}
}
@mixin retina {
@media
(-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
@content;
}
}
@mixin circle($size) {
width: $size;
height: $size;
line-height: $size;
}
/* General Styles */
body {
font-family: $sans-serif-font;
font-size: $font-size-base;
line-height: $line-height-base;
}
a {
color: $black;
&:hover, &:focus {
color: $pink;
}
}
.text-center {
text-align: center;
}
.text-lowercase {
text-transform: lowercase;
}
.text-uppercase {
text-transform: uppercase;
}
/* Magazine Styles */
html, body {
height: 100%; // for full window height
}
.magazine {
height: 100%;
@include min($lg) {
display: flex;
min-height: 100%;
height: auto;
flex-direction: row-reverse;
}
}
/* Magazine Photo */
.magazine-photo {
// @include span(6 last);
display: flex;
align-items: center;
min-height: 500px;
height: 100%;
background: $black url('http://raiscake.me/files/fashion-bg.jpg') no-repeat center center;
background-size: cover;
@include min($lg) {
width: 50%;
min-height: none;
height: auto;
}
}
.magazine-photo__wrapper {
width: 100%;
}
.magazine-photo__title {
margin: 5em 0 .25em;
font-family: $serif-font;
font-size: 2em;
font-style: italic;
font-weight: 400;
line-height: 1.35;
@include min($xs) {
font-size: 3em;
}
@include min($sm) {
font-size: 3.43em;
}
span {
display: block;
font-size: 1.25em;
font-style: normal;
letter-spacing: .06em;
@include min($xxs) {
font-size: 1.75em;
}
}
}
.magazine-photo__line {
width: 50%;
border: 0;
border-bottom: 2px solid black;
opacity: .25;
}
.magazine-photo__desc {
margin: 1.5em 0 0;
color: $gray;
letter-spacing: .14em;
}
/* Magazine Content */
.magazine-content {
position: relative;
overflow: hidden;
@include min($lg) {
width: 50%;
}
}
.magazine-article__image {
position: absolute;
bottom: 2em;
left: 0;
}
.magazine-article__title {
margin: 8em 0 3em;
font-family: $serif-font;
font-size: 1.43em;
font-style: italic;
font-weight: normal;
letter-spacing: .1em;
@include min($xs) {
margin-top: 4em;
}
span {
display: block;
max-width: 330px;
margin: 0 auto;
color: $white;
font-family: $accent-font;
font-size: 3em;
font-style: normal;
letter-spacing: .13em;
line-height: 1.35;
// text-decoration: underline;
background: $black;
@include min($xxs) {
font-size: 4em
}
}
}
.magazine-article__body {
position: relative;
z-index: 1;
width: 90%;
margin: 0 auto 20em;
@include min($xxs) {
width: 80%;
}
@include min($xs) {
column-count: 2;
column-gap: 1em;
padding-left: 5em;
}
@include min($xlg) {
width: 70%;
margin-bottom: 10em;
padding-left: 10em;
}
p {
margin: 0;
padding: .5em .8em;
background: $white;
strong {
display: block;
}
&:first-of-type {
padding: .5em .8em;
color: $white;
background: $black;
text-decoration: underline;
@include min($xs) {
margin-top: -8em;
}
}
}
}
.magazine-article__body-title {
@include circle(150px);
column-span: all;
margin: 0 auto 2em;
color: $white;
font-family: $accent-font;
font-weight: 400;
letter-spacing: .14em;
background: $pink;
border-radius: 50%;
shape-outside: circle();
transform: rotate(10deg);
@include min($xxs) {
float: right;
margin: .5em;
}
@include min($xs) {
float: none;
margin: 0 -1em 2em auto;
}
@include min(1700px) {
margin-right: -2em;
}
}
.trapezoid {
position: absolute;
bottom: 14em;
left: 5em;
z-index: 0;
border-bottom: 950px solid $black;
border-left: 300px solid transparent;
border-right: 100px solid transparent;
height: 0;
width: 400px;
transform: rotate(-40deg);
}
/* Credits */
.magazine-credits {
position: absolute;
top: 2em;
left: 0;
padding: .5em .8em;
color: $white;
font-size: .86em;
background: $black;
a {
color: $white;
}
p {
padding: 0;
line-height: 1.35;
}
}
Also see: Tab Triggers