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 URL's 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 it's URL and the proper URL extention.
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.
<header role="banner">
<h1>Admin Panel</h1>
<ul class="utilities">
<li class="users"><a href="#">My Account</a></li>
<li class="logout warn"><a href="">Log Out</a></li>
</ul>
</header>
<nav role="navigation">
<ul class="main">
<li class="dashboard"><a href="#">Dashboard</a></li>
<li class="write"><a href="#">Write Post</a></li>
<li class="edit"><a href="#">Edit Posts</a></li>
<li class="comments"><a href="#">Comments</a></li>
<li class="users"><a href="#">Manage Users</a></li>
</ul>
</nav>
<main role="main">
<section class="panel important">
<h2>Welcome to Your Dashboard </h2>
<ul>
<li>Important panel that will always be really wide Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
<li>Vestibulum auctor dapibus neque.</li>
</ul>
</section>
<section class="panel">
<h2>Posts</h2>
<ul>
<li><b>2458 </b>Published Posts</li>
<li><b>18</b> Drafts.</li>
<li>Most popular post: <b>This is a post title</b>.</li>
</ul>
</section>
<section class="panel">
<h2>Chart</h2>
<ul>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
<li>Vestibulum auctor dapibus neque.</li>
</ul>
</section>
<section class="panel important">
<h2>Write a post</h2>
<form action="#">
<div class="twothirds">
<label for="name">Text Input:</label>
<input type="text" name="name" id="name" placeholder="John Smith" />
<label for="textarea">Textarea:</label>
<textarea cols="40" rows="8" name="textarea" id="textarea"></textarea>
</div>
<div class="onethird">
<legend>Radio Button Choice</legend>
<label for="radio-choice-1">
<input type="radio" name="radio-choice" id="radio-choice-1" value="choice-1" /> Choice 1
</label>
<label for="radio-choice-2">
<input type="radio" name="radio-choice" id="radio-choice-2" value="choice-2" /> Choice 2
</label>
<label for="select-choice">Select Dropdown Choice:</label>
<select name="select-choice" id="select-choice">
<option value="Choice 1">Choice 1</option>
<option value="Choice 2">Choice 2</option>
<option value="Choice 3">Choice 3</option>
</select>
<div>
<label for="checkbox">
<input type="checkbox" name="checkbox" id="checkbox" /> Checkbox
</label>
</div>
<div>
<input type="submit" value="Submit" />
</div>
</div>
</form>
</section>
<section class="panel">
<h2>feedback</h2>
<div class="feedback">This is neutral feedback Lorem ipsum dolor sit amet, consectetur adipisicing elit. Alias, praesentium. Libero perspiciatis quis aliquid iste quam dignissimos, accusamus temporibus ullam voluptatum, tempora pariatur, similique molestias blanditiis at sunt earum neque.</div>
<div class="feedback error">This is warning feedback
<ul>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
<li>Vestibulum auctor dapibus neque.</li>
</ul> </div>
<div class="feedback success">This is positive feedback</div>
</section>
<section class="panel ">
<h2>Table</h2>
<table>
<tr>
<th>Username</th>
<th>Posts</th>
<th>comments</th>
<th>date</th>
</tr>
<tr>
<td>Pete</td>
<td>4</td>
<td>7</td>
<td>Oct 10, 2015</td>
</tr>
<tr>
<td>Mary</td>
<td>5769</td>
<td>2517</td>
<td>Jan 1, 2014</td>
</tr>
</table>
</section>
</main>
<footer role="contentinfo">Easy Admin Style by Melissa Cabral</footer>
// =========================== colors
// used for page bg
$base-color:#f1f2f7;
// used for panel bg
$primary-color:white;
$primary-text:darkslategray;
$secondary-color: #2a3542;
$secondary-text:#ddd;
$tertiary-color:slategray;
$tertiary-text:#ddd;
$accent:lightsalmon;
$accent-neutral:#dde;
$accent-information:khaki;
$accent-positive:turquoise;
$accent-negative:lightsalmon;
//icons
$logout-icon:"\f08b";
$write-icon:"\f055";
$edit-icon:"\f040";
$comments-icon:"\f27b";
$user-icon:"\f007";
$dashboard-icon:"\f0e4";
// ========================= MIXINS
@mixin clearfix {
&:after {
content: "";
display: table;
clear: both;
}
}
@mixin round-corner() {
-webkit-border-radius: .3rem;
-moz-border-radius: .3rem;
-ms-border-radius: .3rem;
border-radius: .3rem;
}
@mixin left-icon(){
content: "\f248";
font-family: FontAwesome;
padding-right:.6em;
}
@mixin shadow(){
box-shadow:1px 1px 3px rgba(black,.15);
}
@mixin button($color){
background: $color;
border:none;
border-bottom:solid 4px darken($color, 10%);
padding:.7em 3em;
margin: 1em 0;
color:white;
text-shadow: 0 -1px 0 darken($color, 10%);
font-size:1.1em;
font-weight:bold;
display:inline-block;
width:auto;
-webkit-border-radius: .5em;
-moz-border-radius: .5em;
-ms-border-radius: .5em;
border-radius: .5em;
}
@mixin feedback($color, $icon: '\f06a'){
background: lighten( $color, 20%);
color:darken($color, 45%);
margin:1em;
padding: .5em .5em .5em 2em;
border:solid 1px $color;
&:before{
content:$icon;
font-family:fontawesome;
color:darken($color, 20%);
margin-left:-1.5em;
margin-right:.5em;
}
li:before{
border-left-color:lighten($color, 10%);
}
}
@import url(https://fonts.googleapis.com/css?family=Open+Sans:300,400,700,400italic);
@import url(https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css);
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
background:$base-color;
font-family: 'Open Sans', arial, sans-serif;
color:$primary-text;
}
body.login{
background-color: white;
max-width: 500px;
margin: 10vh auto;
padding:1em;
height:auto;
}
/* general utility classes */
.warn{
color:$accent-negative;
}
/* header */
header[role=banner] {
background: white;
@include shadow;
h1 {
margin: 0;
font-weight: 300;
padding: 1rem;
&:before {
@include left-icon;
color: $accent-positive;
}
}
.utilities {
width:100%;
background: $tertiary-color;
color:$tertiary-text;
li {
border-bottom:solid 1px rgba(white,.2);
a{
padding:.7em;
display:block;
}
}
}
}
/* header */
.utilities a:before{
@include left-icon;
}
.logout a:before{
content: $logout-icon;
}
.users a:before{
content:$user-icon;
}
nav[role=navigation] {
background: $secondary-color;
color:$secondary-text;
li{
border-bottom:1px solid rgba(white,.08);
a{
color:$secondary-text;
text-decoration:none;
display:block;
padding:.7em;
&:hover{
background-color:rgba(white,.05);
}
&:before{
@include left-icon;
}
}
}
/* icons */
.dashboard a:before{
content: $dashboard-icon;
}
.write a:before{
content: $write-icon;
}
.edit a:before{
content: $edit-icon;
}
.comments a:before{
content: $comments-icon;
}
.users a:before{
content: $user-icon;
}
}
/* current nav item */
.current{
background-color:rgba(white, .1);
}
.dashboard .dashboard a,.write .write a,.edit .edit a, .comments .comments a, .users .users a{
@extend .current;
}
footer[role=contentinfo] {
background: $tertiary-color;
color:$tertiary-text;
font-size:.8em;
text-align:center;
padding:.2em;
}
/* panels */
.panel {
background-color: $primary-color;
color:$primary-text;
@include round-corner;
margin: 1%;
& > h2, & > ul {
margin: 1rem;
}
}
/* typography */
a{
text-decoration:none;
color:inherit;
}
h2,
h3,
h4 {
font-weight: 300;
margin:0;
}
h2{
color:darken($accent-positive, 15%);
}
b{
color:$accent;
}
.hint{
color:lightslategray;
}
/* lists */
ul, li{
list-style-type: none;
margin: 0;
padding: 0;
}
main{
li {
position: relative;
padding-left: 1.2em;
margin:.5em 0;
&:before {
content: '';
position: absolute;
width: 0;
height: 0;
left:0;
top:.3em;
border-left: solid 10px $accent-neutral;
border-top: solid 5px transparent;
border-bottom: solid 5px transparent;
}
}
}
/* forms */
form{
input, textarea, select{
@include clearfix;
width:100%;
display:block;
border:solid 1px $accent-neutral;
padding:.5em;
}
input[type=checkbox],input[type=radio]{
display:inline;
width:auto;
}
label, legend{
display:block;
margin:1em 0 .5em;
}
input[type=submit]{
@include button($accent-positive);
}
input[type=submit]:hover{
@include button($accent-information);
}
}
/* feedback */
.error{
background-color: lighten( $accent-negative, 20%);
border-color:lighten( $accent-negative, 10%);
}
label.error{
padding:.2em .5em;
}
.feedback{
@include feedback($accent-information, '\f05a' );
&.error{
@include feedback($accent-negative, '\f06a');
}
&.success{
@include feedback($accent-positive, '\f164');
}
}
/* tables */
table{
border-collapse:collapse;
width:96%;
margin:2%;
}
th {
text-align: left;
font-weight: 400;
font-size: 13px;
text-transform: uppercase;
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
padding: 0 10px;
padding-bottom: 14px;
}
tr:not(:first-child):hover {
background: rgba(0, 0, 0, 0.1);
}
td {
line-height: 40px;
font-weight: 300;
padding: 0 10px;
}
@media screen and (min-width:600px) {
html, body {
height: 100%;
}
header[role=banner]{
position:fixed;
top:0;
left:0;
width:100%;
z-index:99;
height:75px;
.utilities{
position: absolute;
top: 0;
right: 0;
background: transparent;
color:$primary-text;
width:auto;
li{
display:inline-block;
a{
padding:.5em 1em;
}
}
}
}
nav[role=navigation] {
position:fixed;
width: 200px;
top:75px;
bottom:0px;
}
main[role=main] {
margin:75px 0 40px 200px;
@include clearfix;
}
.panel{
margin:2% 0 0 2%;
float:left;
width:96%;
@include clearfix;
}
.box{
padding:1rem;
}
.onethird{
@extend .box;
width:33.333%;
float:left;
}
.twothirds{
@extend .box;
width:66%;
float:left;
}
footer[role=contentinfo] {
clear:both;
margin-left:200px;
}
}
@media screen and (min-width:900px) {
footer[role=contentinfo] {
position:fixed;
width:100%;
bottom:0;
left:0px;
margin:0;
}
.panel {
width: 47%;
clear: none;
&.important {
width: 96%;
}
&.secondary {
width: 23%;
}
}
}
/**
* very much a work in progress
* HTML + CSS for a class demo in WIP400 at Platt College San Diego
*
*
* @TODO:
* form inputs
* responsive tables
* more icons: trash
* matching login/register form
* toggle menus
*/
Also see: Tab Triggers