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.
mixin key(main, second)
div&attributes(attributes)=main
span=second
.bb-phone
.vol-up
.silent-switch
.vol-down
.speaker
.camera
.led
.brand
.screen
span
.keyboard
hr
.line#line1
+key("Q", "#").left
+key("W", "1").left
+key("E", "2").left
+key("R", "3").left
+key("T", "(").left
+key("Z", ")").right
+key("U", "_").right
+key("I", "-").right
+key("O", "+").right
+key("P", "@").right
hr
.line#line2
+key("A", "*").left
+key("S", "4").left
+key("D", "5").left
+key("F", "6").left
+key("G", "/").left
+key("H", ":").right
+key("J", ";").right
+key("K", "'").right
+key("L", "\"").right
+key("⌫").right.backspace
hr
.line#line3
+key("alt").left.alt
+key("Y", "7").left
+key("X", "8").left
+key("C", "9").left
+key("V", "?").left
+key("B", "!").right
+key("N", ",").right
+key("M", ".").right
div.right €
span
i.fa.fa-volume-down
+key("↵").right.enter
hr
.line#line4
+key("⇧").shift.left
div.left.mic
i.fa.fa-microphone
span 0
+key().space
+key("sym").sym.right
+key("⇧").shift.right
.info
.section
h1 16
span GB
p internal memory
.section
h1 3.1"
p touchscreen
.section
h1 8
span MP
p back camera
.section
h1 4G
span LTE
p ready
a.devmount(href="http://devmount.de", title="DEVMOUNT", target="_blank") created by
span devmount
@import "//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css";
html, body {
position: relative;
width: 100%;
height: 100%;
}
/* phone outline */
.bb-phone {
position: absolute;
top: 83px;
right: 50%;
height: 499px;
width: 268px;
border-radius: 45% / 10%;
border: 3px solid #000;
box-shadow: 0 0 0 5px #333;
background-color: rgba(0,0,0,1);
background: linear-gradient(135deg, #888 0%, #333 20%, #090909 100%);
/* phone shadow */
&:after {
position: absolute;
content: "";
z-index: -5;
height: 18px;
width: 260px;
bottom: 30px;
left: 10px;
background: #555;
border-radius: 50% / 50%;
box-shadow: 0 60px 10px 2px #999;
}
}
/* screen */
.screen {
position: absolute;
left: 11px;
top: 75px;
width: 246px;
height: 246px;
background: url(http://media.devmount.de/bb_screen_origin.png);
background-size: 246px;
span {
display: block;
width: 100%;
height: 100%;
background: #111;
box-shadow: inset 0 0 3px #000;
transition: background 0.2s ease-in;
&:hover {
background: transparent;
}
}
}
/* BlackBerry brand */
.brand {
position: absolute;
left: calc(50% - 47px);
top: 46px;
width: 95px;
height: 25px;
background: url(http://de.blackberry.com/etc/designs/blackberry_com/images/bbcom/desktop/common/bbcom_desktop_common_header_a/logo.png);
background-repeat: no-repeat;
background-size: 95px;
}
/* speaker */
.speaker {
position: absolute;
left: calc(50% - 33px);
top: 22px;
width: 66px;
height: 5px;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAI0lEQVQIW2N0cXH5r6SkxHDv3j0GEGAECYBZUIAiAFKJoQIA0wsKl/2UZaEAAAAASUVORK5CYII=) repeat;
border-radius: 5px;
border: 1px inset #555;
box-shadow: inset 0 0 2px #000;
}
/* camera */
.camera {
position: absolute;
right: 65px;
top: 19px;
width: 12px;
height: 12px;
border-radius: 50%;
background: #555;
box-shadow: inset 0 0 1px #000;
&:after {
position: absolute;
content: "";
right: 2px;
top: 2px;
width: 4px;
height: 4px;
border-radius: 50%;
background: #888;
border: 3px solid #444;
}
}
/* LED */
.led {
position: absolute;
right: 41px;
top: 21px;
width: 8px;
height: 8px;
border-radius: 50%;
background: #292929;
animation: blink 5s step-end infinite;
@keyframes blink {
45% { background-color: red; }
50% { background-color: #292929; }
90% { background-color: yellow; }
95% { background-color: #292929; }
}
}
/* volume */
.vol-up, .vol-down {
position: absolute;
right: -10px;
width: 2px;
border-right: 1px solid #ccc;
border-left: 3px solid #555;
border-radius: 0 3px 4px 0;
}
.vol-up {
height: 42px;
top: 87px;
border-top: 1px solid #aaa;
border-bottom: 5px solid #222;
background: linear-gradient(180deg, #fff 0%, #aaa 7%, #aaa 100%);
}
.vol-down {
height: 45px;
top: 170px;
border-top: 2px solid #fff;
border-bottom: 0;
background: linear-gradient(180deg, #fff 0%, #aaa 13%, #aaa 88%, #222 90%);
}
/* switch */
.silent-switch {
position: absolute;
right: -9px;
width: 2px;
height: 31px;
top: 136px;
border-top: 1px solid #aaa;
border-left: 3px solid #555;
border-bottom: 0;
border-right: 0;
border-radius: 0 3px 4px 0;
background: linear-gradient(180deg, #fff 0%, #aaa 13%, #aaa 85%, #222 87%);
&:after {
content: "";
position: absolute;
right: 0;
top: 6px;
width: 2px;
height: 16px;
border-top: 1px solid #aaa;
border-left: 0;
border-bottom: 0;
border-right: 0;
border-radius: 0 3px 4px 0;
background: linear-gradient(180deg, #fff 0%, #aaa 13%, #aaa 85%, #222 87%);
}
}
/* keyboard */
.keyboard {
position: absolute;
bottom: 30px;
left: -6px;
width: 280px;
font-size: 0;
hr {
height: 5px;
border: 1px solid #111;
border-top: 1px solid #222;
border-bottom: 2px solid #111;
background: linear-gradient(90deg, #fff 0px, #aaa 5px, #666 230px, #444 270px, #444 274px, #eee 275px);
margin: 1px 0 0 0;
}
.line {
margin: 0 5px;
color: #eee;
background: #000;
& > div{
position: relative;
display: inline-block;
width: 23px;
height: 25px;
margin: 0 1px;
background: #111;
border-left: 1px solid #444;
border-right: 1px solid #222;
font-family: Helvetica;
font-size: 12px;
line-height: 32px;
text-align: center;
overflow: hidden;
cursor: pointer;
transition: height 0.1s, text-shadow 0.1s;
&.left {
background: radial-gradient(32px at -15% 80%, #111 5%, #555 75%, #333 79%, #444 83%, #000 100%);
}
&.right {
background: radial-gradient(32px at 117% 80%, #000 5%, #222 75%, #111 79%, #555 83%, #222 100%);
}
&:last-child {
margin-right: 0;
}
&:first-child {
margin-left: 0;
}
&:active {
height: 23px;
}
&:hover {
color: fff;
text-shadow: 0 0 5px #fff;
}
}
.sym, .alt {
font-size: 10px;
line-height: 25px;
}
.sym, .mic, .shift {
width: 29px;
}
.shift.left, div.mic {
background: radial-gradient(32px at 0% 80%, #111 5%, #555 75%, #333 79%, #444 83%, #000 100%);
}
.shift.right, div.sym {
background: radial-gradient(32px at 100% 80%, #000 5%, #222 75%, #111 79%, #555 83%, #222 100%);
}
.shift {
line-height: 16px;
}
.backspace {
line-height: 29px;
font-size: 14px;
}
.enter {
font-size: 12px;
line-height: 26px;
}
.mic {
line-height: 29px;
font-size: 11px;
}
.space {
width: 80px;
position: relative;
background: #1b1b1b;
&:before {
content:"";
width: 60px;
height: 20px;
position: absolute;
top: 0;
left: calc(50% - 30px);
background: #111;
border-radius: 0 0 20% 20% / 100%;
box-shadow: 0 -7px 10px 5px #555;
}
&:after {
content:"";
width: 26px;
height: 3px;
border: 2px solid #fff;
border-top: 0;
position: absolute;
top: 8px;
left: calc(50% - 13px);
}
}
span {
position: absolute;
font-size: 9px;
line-height: 10px;
top: 1px;
}
.right span {
right: 2px;
}
.left span {
left: 2px;
}
}
}
#line4 {
width: 216px;
margin: 0 auto;
border-radius: 0 0 30% 30% / 100%;
border-bottom: 1px solid #000;
box-shadow: 0 0 3px 1px #000;
overflow: hidden;
}
/* phone infos to the right */
.info {
position: absolute;
left: 50%;
top: 78px;
padding-left: 80px;
color: #777;
width: 200px;
text-align: center;
.section {
margin: 0 0 50px 0;
}
h1 {
font: 55px Arial;
margin: 0;
padding: 0;
}
h1 span {
margin: 0;
font: 25px Arial;
line-height: 45px;
vertical-align: top;
padding-left: 5px;
}
p {
margin: 0;
text-transform: uppercase;
color: #999;
}
}
.devmount {
position: fixed;
bottom: 0;
right: 0;
height: 20px;
line-height: 20px;
text-decoration: none;
font: 17px Arial;
color: #111;
padding: 10px 40px 10px 0;
margin-right: 10px;
background: url(http://media.devmount.de/devmount_small_dark.png) right center no-repeat;
transition: background-position .3s, color .3s;
span {
position: absolute;
right: 3px;
color: transparent;
transition: inherit;
}
&:hover {
background-position: left center;
color: transparent;
span {
color: #111;
}
}
}
Also see: Tab Triggers