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="monopoly-board">
<div class="card-holder">
</div>
<div class="roads-wrapper">
<div class="row">
<div>
<div class="corner start">
<span>Go</span>
</div>
<ul>
<li class="road brown">
<div class="road-name">Html <br/>Avenue</div>
<div class="price">60</div>
</li>
<li class="chance like">
<div class="chance-name">Like <br/>this pen</div>
<div class="picto"></div>
</li>
<li class="road brown">
<div class="road-name">CSS <br/>Road</div>
<div class="price">60</div>
</li>
<li class="station">
<div class="road-name">Codepen <br/>Station</div>
<div class="price">200</div>
</li>
<li class="road light-blue">
<div class="road-name">Javascript <br/>plaza</div>
<div class="price">100</div>
</li>
<li class="road light-blue">
<div class="road-name">PHP <br/>avenue</div>
<div class="price">120</div>
</li>
</ul>
</div>
</div>
<div class="row">
<div>
<div class="corner bugs">
<span>BUGS <small>You're stuck for one turn</small></span>
</div>
<ul>
<li class="road purple">
<div class="road-name">C++ <br/>Avenue</div>
<div class="price">140</div>
</li>
<li class="road purple">
<div class="road-name">Python <br/>Road</div>
<div class="price">140</div>
</li>
<li class="station">
<div class="road-name">Stack Overflow <br/>Station</div>
<div class="price">200</div>
</li>
<li class="road orange">
<div class="road-name">React.JS <br/>road</div>
<div class="price">160</div>
</li>
<li class="chance pinned">
<div class="chance-name">Pinne<br/> this pen</div>
<div class="picto"></div>
</li>
<li class="road orange">
<div class="road-name">Three.js <br/>road</div>
<div class="price">180</div>
</li>
</ul>
</div>
</div>
<div class="row">
<div>
<div class="corner coffee">
<span>Coffee break</span>
</div>
<ul>
<li class="road red">
<div class="road-name">Less road</div>
<div class="price">200</div>
</li>
<li class="chance fork">
<div class="chance-name">Fork <br/>this pen</div>
<div class="picto"></div>
</li>
<li class="road red">
<div class="road-name">Sass highway</div>
<div class="price">220</div>
</li>
<li class="station">
<div class="road-name">FontAwesome<br/> Station</div>
<div class="price">200</div>
</li>
<li class="road yellow">
<div class="road-name">Django avenue</div>
<div class="price">240</div>
</li>
<li class="road yellow">
<div class="road-name">Bootstrap <br/>Plaza</div>
<div class="price">260</div>
</li>
</ul>
</div>
</div>
<div class="row">
<div>
<div class="corner error">
<span>404 Error <small>wait for a turn</small></span>
</div>
<ul>
<li class="road green">
<div class="road-name">SQL <br/>Avenue</div>
<div class="price">260</div>
</li>
<li class="road green">
<div class="road-name">Angular plaza</div>
<div class="price">280</div>
</li>
<li class="chance follow">
<div class="chance-name">Follow me</div>
<div class="picto"></div>
</li>
<li class="station">
<div class="road-name">Github <br/>Station</div>
<div class="price">200</div>
</li>
<li class="road blue">
<div class="road-name">Node<br/> avenue</div>
<div class="price">300</div>
</li>
<li class="road blue">
<div class="road-name">Go road</div>
<div class="price">350</div>
</li>
</ul>
</div>
</div>
</div>
</div>
$brown: #784d3c;
$light-blue: #badbee;
$purple: #aa3b80;
$orange: #d58a37;
$red: #cd0722;
$yellow: #fff139;
$green: #5fa55d;
$blue: #2c67a1;
$gray: #1e1f26;
$black:#201e21;
$board-color: #d2e2c7;
body{
background:$gray;
perspective:1050px;
perspective-origin: 50% 100px;
overflow:hidden;
}
.monopoly-board{
width:100%;
max-width:750px;
margin: 20px auto;
position:relative;
.roads-wrapper{
position:absolute;
top:0;
left:0;
width:100%;
padding-bottom:100%;
height:0;
background-color:$board-color;
transform: rotateX(75deg) rotateZ(0deg);
animation:rotate linear 25s;
animation-iteration-count: infinite;
border-radius:10px;
overflow:hidden;
&:before {
content: "";
position: absolute;
width: 100%;
height: 100%;
z-index: -1;
transform: rotate(45deg);
background-image:url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/230827/monopoly.jpg');
background-size:75%;
background-repeat:no-repeat;
background-position:center;
}
.row{
position: absolute;
width: 84.5%;
> div{
display: flex;
flex-direction: row-reverse;
flex-wrap: wrap;
width:100%;
border-top: 3px solid #201e21;
.corner {
width: 18%;
padding-bottom: 18%;
height: 0;
align-items: center;
justify-content: center;
position:relative;
& > span {
position: absolute;
text-transform: uppercase;
left: 50%;
top: 50%;
transform: translate(-50%, -50%) rotate(-45deg);
font-weight: 900;
font-family: sans-serif;
letter-spacing: 1px;
align-items: center;
display: flex;
flex-wrap: wrap;
justify-content: center;
small{
font-size: 10px;
display: block;
font-weight: 100;
text-transform: initial;
text-align: center;
}
}
&.start > span{
font-size: 40px;
&:after {
content: '\f30a';
font-family: "Font Awesome 5 Pro";
display: block;
font-size: 50px;
color: $red;
font-weight: 500;
line-height: 21px;
}
}
&.bugs > span{
font-size:25px;
&:before {
content: '\f188';
font-family: "Font Awesome 5 Pro";
display: block;
font-size: 30px;
color: $red;
font-weight: bold;
line-height: 35px;
}
}
&.coffee > span {
font-size:15px;
text-align:center;
&:before{
content:'\f7b7';
font-family: "Font Awesome 5 Pro";
display: block;
font-size: 25px;
color: $brown;
font-weight: bold;
line-height: 35px;
}
}
&.error > span{
text-align:center;
}
}
> ul{
list-style: none;
display: flex;
flex-direction: row-reverse;
padding: 0;
margin: 0;
width: calc(82% - 3px );
border-right: 3px solid #201e21;
li {
width: 100%;
border-left: 3px solid $black;
display:flex;
flex-direction:column;
flex-wrap: wrap;
justify-content: space-between;
position:relative;
&:last-child{
border-left:0;
}
&.chance{
justify-content: flex-start;
.chance-name{
font-size:10px;
padding-top:15%;
text-align:center;
text-transform:uppercase;
}
.picto{
text-align:center;
padding-top:15px;
&:before{
font-family:"Font Awesome 5 Pro";
color:$black;
font-size:35px;
}
}
&.like{
.picto:before{
content:'\f004';
}
}
&.pinned{
.picto:before{
content:'\f08d';
}
}
&.follow{
.picto:before{
content:'\f8ea';
font-weight:bold;
}
}
&.fork{
.picto:before{
content:'\f126';
}
}
}
&.station{
text-align:center;
text-transform:uppercase;
.road-name{
justify-content:center;
font-size:10px;
padding-top:15%;
&:after{
content:'\f239';
font-family:"Font Awesome 5 Pro";
display:block;
font-size:35px;
padding-top:10px;
}
}
}
&.road{
text-align:center;
text-transform:uppercase;
&:before{
content:'';
height:20%;
width:100%;
display:block;
border-bottom:3px solid $black;
position:absolute;
top:0;
left:0;
}
.road-name{
display:flex;
padding-top:50%;
justify-content:center;
font-size:10px;
}
&.brown{
&:before{
background:$brown;
}
}
&.light-blue{
&:before{
background:$light-blue;
}
}
&.purple{
&:before{
background:$purple;
}
}
&.orange{
&:before{
background:$orange;
}
}
&.red{
&:before{
background:$red;
}
}
&.yellow{
&:before{
background:$yellow;
}
}
&.green{
&:before{
background:$green;
}
}
&.blue{
&:before{
background:$blue;
}
}
}
.price{
display:flex;
justify-content:center;
font-size:10px;
padding-bottom:10px;
&:before{
content:'\f1cb';
font-family:"Font Awesome 5 Brands";
margin-right:5px;
}
}
}
}
}
&:nth-child(1){
bottom:0;
right:0;
}
&:nth-child(2){
top: 100%;
right: 84.5%;
transform: rotate(90deg);
transform-origin: 100% 0%;
}
&:nth-child(3){
top: 15.5%;
right: 100%;
transform: rotate(180deg);
transform-origin: 100% 0;
}
&:nth-child(4){
top: 0;
left: 0;
transform: rotate(270deg);
transform-origin: 100% 0;
}
}
}
}
@keyframes rotate {
from{
transform: rotateX(75deg) rotateZ(45deg);
}
50%{
transform: rotateX(80deg) rotateZ(-202deg);
}
to{
transform: rotateX(75deg) rotateZ(-405deg);
}
}
Also see: Tab Triggers