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.
<svg width="0" height="0">
<defs>
<symbol id="icon" viewBox="0 0 13 30">
<polygon points="5 0 13 0 13 30 5 30 0 15" fill="var(--red-purple)"/>
</symbol>
<pattern id="court" x="-140" y="-50" width="1080" height="723" patternUnits="userSpaceOnUse">
<image x="0" y="0" xlink:href="http://res.cloudinary.com/jduquain/f_auto,q_auto/court.jpg" width="1280" height="823"></image>
<rect x="0" y="0" width="1280" height="823" fill="rgba(255,255,255,.25)"/>
</pattern>
</defs>
</svg>
<div class="grid">
<a class="inspiration" href="http://res.cloudinary.com/jduquain/f_auto,q_auto/flyer-12.jpg" target="_blank">Inspiration</a>
<div class="top">
<p class="cellone">sports</p>
<p class="celltwo">16</p>
<div class="border"></div>
<p class="cellthree">www.jduquain.com</p>
<p class="cellfour">Thursday March 11, 2010</p>
</div>
<div class="xparent">
<img src="http://res.cloudinary.com/jduquain/q_auto/players-xparent.png" width="425" alt="two women basketball players at tipoff" class="img-tipoff">
</div>
<div class="heading">
<h3><abbr title="National Collegiate Athletic Association">NCAA</abbr> Preview</h3>
<p class="matchup">No. 2 <abbr title="University of California San Diego">UCSD</abbr> vs. No. 7 Humboldt State</p>
</div>
<div class="bg">
<svg class="circle--svg" viewBox="-75 -10 450 450">
<path id="circ" d="M0,150A150,150 0 1 1300,150A150,150 0 1 10,150" transform="rotate(-41, 150 150)" fill="none"/>
<text>
<textPath xlink:href="#circ">
<tspan dy="-10">The NCAA <tspan dx="28">Regional matchup between UCSD and HSU</tspan> </tspan><tspan dx="-233" dy="12">makes the <tspan dx="23">3rd time in as many weeks the teams have met. </tspan></tspan>
<tspan dx="216" fill="var(--red-purple)">and this time, <tspan dx="55">the stakes can't get any higher.</tspan></tspan>
</textPath>
</text>
</svg>
</div>
<div class="main">
<div class="panel panel--one">
<div class="svg--icon-wrap">
<svg width="15" height="24.5">
<use xlink:href="#icon" />
</svg>
</div>
<div class="title">
<h4>
<span>UCSD Players</span>
<span>To Watch</span>
</h4>
</div>
<div class="players">
<div class="tiffany player">
<img src="http://res.cloudinary.com/jduquain/q_auto/player--1-xparent.png" width="70" alt="Tiffany Hunter" class="img-player--one">
<h5>Tiffany Hunter</h5>
<div class="stats--wrap">
<span>Junior Forward</span>
<span>2nd team all–NCAA</span>
<span>11.3 ppg</span>
<span>72 rebounds</span>
<span>49.1 FG%</span>
</div>
</div>
<div class="chelsea player">
<img src="http://res.cloudinary.com/jduquain/q_auto/player--2-xparent.png" width="75" alt="Chelsea Carlisle" class="img-player--two">
<h5>Chelsea Carlisle</h5>
<div class="stats--wrap">
<span>Sophmore Guard</span>
<span>1st team all–NCAA</span>
<span>Team leader in points, assists and steals</span>
<span>12.5 ppg</span>
<span>6.5 apg</span>
<span>2.2 steals</span>
</div>
</div>
<div class="annette player">
<img src="http://res.cloudinary.com/jduquain/q_auto/player--3-xparent.png" width="85" alt="Annette Ilg" class="img-player--three">
<h5>Annette Ilg</h5>
<div class="stats--wrap">
<span>Senior Guard</span>
<span>2nd team all–NCAA</span>
<span>10.3 ppg</span>
<span>55 rebounds</span>
<span>1.8 steals</span>
</div>
</div>
</div>
</div>
<div class="panel--two">
<svg class="svg--up" width="211" height="230">
<g transform="translate(-6,-8)" fill="url('#court') #fff">
<text class="upintheair" x="41" y="120">
<tspan class="up">Up</tspan>
<tspan class="air" x="45" dy="105">Air</tspan>
</text>
<text class="in" x="13" dy="120" transform="rotate(-71,97,142)">in the</text>
</g>
</svg>
<div class="byline">
<p class="by">By Liam Rome</p>
<p class="author">Senior Staff Writer</p>
<p class="photographer">Photo Illustration by jduquain.com</p>
</div>
<div class="story">
<p>Master. Luke Sky­walk­er, Jedi Kni­ght. I told you not to admit him! I must be al­low­ed to speak. Jedi must be al­low­ed to speak. You weak mind­ed fool! He's using an old jedi mind trick. You will bring c­ap­tain Solo and the Wook­iee to me. Woah ha ha ha! Your mind powers will not work on me, boy. </p>
<p>Never­the­less, I'm taking cap­tain Solo and his friends. You can eit­her prof­it by this or be destroy­ed! It's your cho­ice. But I warn you not to under­est­imate my pow­ers. </p>
<p>Master Luke, you're stand­ing on… There will be no bar­gain young jedi. I shall en­joy watch­ing you die. Bascka! Oh no, the rancor!</p>
</div>
<p class="continue">See <span>W. Basetball</span> page 15</p>
</div>
<div class="panel panel--three">
<div class="svg--icon-wrap">
<svg width="15" height="24.5">
<use xlink:href="#icon" />
</svg>
</div>
<div class="title">
<h4>
<span>NCAA</span>
<span>West Regional</span>
</h4>
</div>
<div class="cal">
<div class="matchup--wrap">
<h5>First-Round Matchup</h5>
<div class="try">12</div>
<p class="date">March 12, 2010</p>
<p style="margin-bottom: 2px;">Palace Royal Ballroom</p>
<p>No 2 UCSD (25–4), 1st in NCAA</p>
<p class="vs">vs.</p>
<p>No 7 HSU (19–10), 4th in NCAA</p>
</div>
<div class="matchup--wrap">
<h5>Recent Meetings</h5>
<div class="try">12</div>
<p class="date">March 12, 2010</p>
<p class="paddingbottom">HSU 84, UCSD 80</p>
<div class="try">26</div>
<p class="date">February 26, 2010</p>
<p>UCSD 86, HSU 51</p>
</div>
</div>
<div class="nums">
<h5>By The Numbers</h5>
<div class="line--wrap">
<p>UCSD</p>
<div class="line"></div>
<p>HSU</p>
</div>
<div class="comparison--wrap">
<div class="main--stat ppg">
<p class="compare--title compare--title--one">Points per game</p>
<div class="compare">
<p>75.2</p>
<div class="bar--nums bar--nums--one"></div>
<p>70.5</p>
</div>
</div>
<div class="main--stat ppg">
<p class="compare--title compare--title--two">Field Goal %</p>
<div class="compare">
<p>44.4</p>
<div class="bar--nums bar--nums--two"></div>
<p>41.9</p>
</div>
</div>
<div class="main--stat ppg">
<p class="compare--title compare--title--three">3 pt. Field Goal %</p>
<div class="compare">
<p>31.6</p>
<div class="bar--nums bar--nums--three"></div>
<p>36.5</p>
</div>
</div>
<div class="main--stat ppg">
<p class="compare--title compare--title--four">Free Throw %</p>
<div class="compare">
<p>66.7</p>
<div class="bar--nums bar--nums--four"></div>
<p>68.4</p>
</div>
</div>
<div class="main--stat ppg">
<p class="compare--title compare--title--five">Rebound Margin</p>
<div class="compare">
<p><span>0</span>4.4</p>
<div class="bar--nums bar--nums--five"></div>
<p><span>0</span>0.5</p>
</div>
</div>
<div class="main--stat ppg">
<p class="compare--title compare--title--six">Turnover Margin</p>
<div class="compare">
<p><span>0</span>4.3</p>
<div class="bar--nums bar--nums--six"></div>
<p>-0.4</p>
</div>
</div>
<div class="main--stat ppg">
<p class="compare--title compare--title--seven">Assists Per Game</p>
<div class="compare">
<p>13.1</p>
<div class="bar--nums bar--nums--seven"></div>
<p>15.9</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
:root {
box-sizing: border-box;
--gray-100: hsl(204, 45%, 98%);
--gray-200: hsl(210, 38%, 95%);
--gray-300: hsl(214, 32%, 91%);
--gray-400: hsl(211, 25%, 84%);
--gray-500: hsl(214, 20%, 69%);
--gray-600: hsl(216, 15%, 52%);
--gray-700: hsl(218, 17%, 35%);
--gray-800: hsl(218, 23%, 23%);
--gray-900: hsl(220, 26%, 14%);
--red-purple: hsl(356, 100%, 16%);
--brown-gray: hsl(27, 10%, 83%);
--brown-gray-700: hsl(35, 13%, 74%);
}
*, ::before, ::after {
box-sizing: inherit;
text-decoration: none;
list-style-type: none;
margin: 0;
padding: 0;
}
body {
font-size: 100%;
color: var(--var-gray-700);
background-image: linear-gradient(120deg, var(--gray-500), var(--gray-700));
height: 120vh;
font-family: 'Source Serif Pro', serif;
}
.inspiration {
font-size: .7rem;
color: #333;
position: absolute;
top: 1.4em;
right: 10em;
text-decoration: underline;
z-index: 30000;
}
.inspiration:hover, .inspiration:focus {
color: var(--red-purple);
}
.grid {
width: 600px;
height: 890px;
background-color: #fff;
margin: 2em auto;
padding: 2rem;
display: grid;
grid-template-columns: 1fr 1.3fr 1fr;
grid-template-rows: 91px 330px 1fr;
position: relative;
}
.grid::after {
content: "";
position: absolute;
top: 1.8rem;
left: 1.6rem;
right: 1.6rem;
bottom: 1.8rem;
border: 1px solid var(--brown-gray);
border-top: 0;
z-index: 0;
}
.top {
position: absolute;
font-size: .5rem;
display: grid;
grid-template-columns: 1fr 1fr;
margin: 1.8rem 1.5rem 0 1.5rem;
border-left: 3px solid white;
border-right: 3px solid white;
z-index: 19500;
text-transform: uppercase;
padding-bottom: 4px;
}
.cellone {
grid-column: 1 / 2;
font-size: .8rem;
font-weight: 700;
}
.celltwo {
grid-column: 2 / 3;
justify-self: end;
font-weight: 900;
font-size: .7rem;
font-family: 'Roboto', sans-serif;
transform: translateY(2px);
}
.cellthree {
grid-column: 1 / 2;
color: var(--brown-gray-700);
font-size: .45rem;
}
.cellfour {
grid-column: 2 / 3;
justify-self: end;
font-size: .45rem;
}
.border {
width: 548px;
height: 1px;
background-color: var(--brown-gray);
grid-column: 1 / 3;
}
.heading {
background-color: var(--red-purple);
grid-column: 2 / 3;
grid-row: 1 / 2;
clip-path: polygon(0% 0%, 100% 0%, 100% 62px, 50% 100%, 0 62px);
text-transform: uppercase;
text-align: center;
padding-top: 1.2rem;
z-index: 20000;
}
.heading h3 {
font-size: .7rem;
font-weight: 500;
background-color: var(--brown-gray);
border-top: 1px solid #fff;
border-bottom: 1px solid #fff;
margin-bottom: .2rem;
padding-top: 2px;
}
.matchup {
color: #fff;
font-size: .55rem;
}
.bg {
margin-top: 28px;
grid-column: 1 / 4;
grid-row: 1 / 3;
background-image: linear-gradient(to right, rgba(0,0,0,.5), rgba(255,255,255,.6)), url(http://res.cloudinary.com/jduquain/f_auto,q_auto/court.jpg);
background-size: 155%;
background-position: 50% 50%;
clip-path: polygon(0% 0%, 50% 77px, 100% 0%, 100% 100%, 50% 300px, 0% 100%);
position: relative;
}
.xparent {
position: absolute;
top: 84px;
left: 65px;
z-index: 25000;
}
.img-tipoff {
width: 425px;
height: auto;
display: block;
}
.circle--svg {
fill: none;
}
.circle--svg text {
fill: #fff;
font-size: 8.5px;
}
.main {
grid-column: 1 / 4;
height: 101.3%;
transform: translateY(-16.2%);
clip-path: polygon(0% 100%, 0% 91px, 50% 0%, 100% 91px, 100% 100%);
display: grid;
grid-template-columns: 1fr 1.3fr 1fr;
}
.panel--one {
grid-column: 1 / 2;
background-color: var(--brown-gray);
position: relative;
}
.panel .title {
font-family: 'Roboto', sans-serif;
margin: 6.5rem 0 1rem 0;
font-size: .55rem;
text-transform: uppercase;
background-color: var(--brown-gray-700);
margin-left: 1.8rem;
padding: .2rem .15rem 0.10rem .15rem;
}
.svg--icon-wrap {
position: absolute;
top: 104px;
left: 13px;
}
.panel span {
display: block;
}
.panel h4 span:first-of-type {
font-weight: 300;
}
.panel h4 span:last-of-type {
color: var(--red-purple)
}
.players {
margin: .5rem .5rem 0 0;
font-size: .45rem;
}
.players h5 {
font-size: .52rem;
text-transform: uppercase;
color: var(--red-purple);
position: relative;
margin-bottom: 3px;
padding-top: 4px;
}
.players h5::after {
position: absolute;
content: "";
background-color: var(--red-purple);
height: 1px;
bottom: 0;
left: 24px;
width: 79px;
}
.player {
text-align: right;
padding-top: 4px
}
.img-player--one {
float: right;
width: 70px;
shape-outside: polygon(37.14% -8.04%, -10% 44.38%, 72.85% 110.83%, 100% 90%);
margin-left: .2rem;
}
.img-player--two {
float: left;
width: 75px;
shape-outside: polygon(56.26% 37.33%, -4.54% 50.75%, 93.34% 108.44%, 67.22% 68.51%);
margin-left: .25rem;
}
.chelsea {
text-align: left;
}
.chelsea h5 {
margin-top: 3rem;
white-space: nowrap
}
.chelsea h5::after {
left: 39px;
width: 86px;
}
.img-player--three {
float: right;
width: 85px;
shape-outside: polygon(46.21% -4.75%, 8.14% 47.67%, 32.03% 105.9%, 110.2% 45.63%);
margin-left: .2rem;
}
.annette {
text-align: right;
}
.annette h5 {
margin-top: 1.1rem;
}
.annette h5::after {
left: 33px;
width: 66px;
}
.panel--two {
grid-column: 2 / 3;
background-color: var(--red-purple);
color: #fff;
}
.svg--up {
width: 211px;
height: 230px;
}
.upintheair {
font-size: 6.3rem;
}
.in {
font-size: 1.4rem;
}
.byline {
font-weight: 300;
padding: .2rem 0 .3rem 0;
font-size: .55rem;
width: 70%;
margin: 0 auto 1rem auto;;
text-align: center;
border-top: 1px solid rgba(255,255,255,.7);
border-bottom: 1px solid rgba(255,255,255,.7);
position: relative;
}
.byline::after {
content: "";
position: absolute;
width: 35px;
height: 3px;
background-color: #fff;
bottom: -3px;
left: 0;
}
.photographer {
margin-top: .1rem;
font-size: .4rem;
text-transform: uppercase;
}
.story {
font-size: .46rem;
width: 70%;
margin: 0 auto;
text-align: justify;
hyphens: auto;
-webkit-hyphens: auto;
}
.story p:first-of-type::first-letter {
font-size: 2.7rem;
float: left;
line-height: .83;
margin-right: .2rem;
font-weight: 400;
}
.story p:not(:last-of-type) {
margin-bottom: .15rem;
}
.continue {
font-size: .46rem;
margin: 1rem auto 0 auto;
width: 50%;
}
.continue span {
font-size: .5rem;
text-transform: uppercase;
font-weight: 700;
}
.panel--three {
grid-column: 3 / 4;
background-color: var(--brown-gray);
position: relative;
}
.panel--three .title {
margin-left: auto;
margin-right: 1.8rem;
text-align: right;
padding-right: .25rem;
}
.panel--three .svg--icon-wrap {
left: auto;
right: 13px;
transform: rotate(180deg) translateY(5px);
}
.cal {
position: relative;
padding: .1rem 1rem 0 1rem;
font-size: .45rem;
}
.cal h5 {
font-family: 'Roboto', sans-serif;
text-transform: uppercase;
font-size: .53rem;
border-bottom: 1px solid var(--brown-gray-700);
margin-bottom: .4rem;
padding-bottom: 1px;
}
.matchup--wrap {
margin-bottom: .65rem;
}
.date {
padding: 0 0 3px 15px;
}
.try {
width: 9px;
height: 10px;
background-color: #fff;
position: absolute;
box-shadow: 1px 1px 0px rgba(0,0,0,.2);
display: flex;
align-items: center;
justify-content: center;
color: var(--red-purple);
font-size: 7px;
font-weight: 600;
}
.try::before {
content: "";
position: absolute;
width: 9px;
height: 1px;
top: -1px;
background-image: linear-gradient(to right, transparent 0%, transparent 10%, #000 10%, #000 30%, transparent 30%, transparent 40%, #000 40%, #000 60%, transparent 60%, transparent 70%, #000 70%, #000 90%, transparent 90%);
}
.vs {
margin-left: 3rem;
}
.paddingbottom {
padding-bottom: 3px;
}
.nums {
padding: 2px 1rem 0 1rem;
}
.nums h5 {
font-family: 'Roboto', sans-serif;
text-transform: uppercase;
font-size: .52rem;
border-bottom: 1px solid var(--brown-gray-700);
margin-bottom: .2rem;
padding-bottom: .1rem;
}
.line--wrap {
font-family: 'Roboto', sans-serif;
font-size: .46rem;
font-weight: 700;
display: flex;
align-items: center;
margin-bottom: .15rem;
}
div.line {
height: 2px;
background-color: var(--red-purple);
flex: 0 0 64%;
margin-left: 5px;
margin-right: 5px;
}
.comparison--wrap {
font-size: .44rem;
}
.main--stat {
display: flex;
flex-wrap: wrap;
margin-bottom: .2rem;
}
.compare--title {
flex: 0 0 100%;
margin-left: 38px;
}
.compare--title--two {
margin-left: 44px;
}
.compare--title--three {
margin-left: 36px;
}
.compare--title--four {
margin-left: 42px;
}
.compare--title--five {
margin-left: 39px;
}
.compare--title--six {
margin-left: 39px;
}
.compare--title--seven {
margin-left: 39px;
}
.compare {
display: flex;
align-items: center;
}
.compare p:first-of-type {
transform: translateX(5px);
}
.compare p:last-of-type {
margin-left: 13px;
}
/* is not working */
.compare p span {
display: inline;
opacity: 0;
}
.bar--nums {
flex: 0 0 83px;
height: 7px;
background-image: linear-gradient(to right, var(--red-purple) 0%, var(--red-purple) 58%, var(--brown-gray-700) 58%);
margin: 0 .25rem 0 0;
transform: translateX(12px)
}
.bar--nums--two {
background-image: linear-gradient(to right, var(--red-purple) 0%, var(--red-purple) 64%, var(--brown-gray-700) 64%);
}
.bar--nums--three {
background-image: linear-gradient(to right, var(--red-purple) 0%, var(--red-purple) 30%, var(--brown-gray-700) 30%);
}
.bar--nums--four {
background-image: linear-gradient(to right, var(--red-purple) 0%, var(--red-purple) 46%, var(--brown-gray-700) 46%);
}
.bar--nums--five {
background-image: linear-gradient(to right, var(--red-purple) 0%, var(--red-purple) 68%, var(--brown-gray-700) 68%);
}
.bar--nums--six {
background-image: linear-gradient(to right, var(--red-purple) 0%, var(--red-purple) 73%, var(--brown-gray-700) 73%);
}
.bar--nums--seven {
background-image: linear-gradient(to right, var(--red-purple) 0%, var(--red-purple) 31%, var(--brown-gray-700) 31%);
}
Also see: Tab Triggers