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="menu">
<a href="#" class="name">Menu
<i class="fa fa-toggle-off" id="toggle"></i>
</a>
<ul class="hidden">
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#portfolio">Portfolio</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</div>
<header id="home">
<div class="header-content">
<h1>SEO<span>4</span>Opt<span>1</span>m</h1>
<h3>SEO & Content Marketing Services</h3>
</div>
</header>
<section id="about">
<div class="row">
<article>
<h2>About Us</h2>
<p>Search engine optimization (SEO) is the process of affecting the online visibility of a website or a web page in a web search engine's unpaid results—often referred to as "natural", "organic", or "earned" results. In general, the earlier (or higher ranked on the search results page), and more frequently a website appears in the search results list, the more visitors it will receive from the search engine's users; these visitors can then be converted into customers.</p>
<p>SEO may target different kinds of search, including image search, video search, academic search, news search, and industry-specific vertical search engines. SEO differs from local search engine optimization in that the latter is focused on optimizing a business' online presence so that its web pages will be displayed by search engines when a user enters a local search for its products or services. The former instead is more focused on national or international searches.</p>
</article>
</div>
</section>
<!-- Portfolio Section -->
<section id="portfolio">
<div class="row">
<article>
<h2>Our Portfolio</h2>
<p>To view the projects from our prtfolio click on each title panel to reveal the content.</p>
<div class="panel">
<div class="panel-head">
<h3>Project One</h3>
<i class="fa fa-plus-circle"></i>
</div>
<article class="panel-body">
<h4>Project One Description.</h4>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. </p>
</article>
</div><!-- /.panel -->
<div class="panel">
<div class="panel-head">
<h3>Project Two</h3>
<i class="fa fa-plus-circle"></i>
</div>
<article class="panel-body">
<h4>Project Two Description.</h4>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. </p>
</article>
</div><!-- /.panel -->
<div class="panel">
<div class="panel-head">
<h3>Project Three</h3>
<i class="fa fa-plus-circle"></i>
</div>
<article class="panel-body">
<h4>Project Three Description.</h4>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. </p>
</article>
</div><!-- /.panel -->
</article>
</div>
</section>
<!-- Contact Section -->
<section id="contact">
<div class="row">
<article>
<h2>If You Wish To Contact Us</h2>
<form>
<fieldset>
<legend>Use This Contact Form:</legend>
<label for="name">Your Name:</label>
<input type="text" name="name" placeholder="✎ ...">
<label for="email">Your Email:</label>
<input type="email" name="email" placeholder="✎ ...">
<label for="text">Your Message:</label>
<textarea name="text" id="text" cols="30" rows="5" placeholder="✎ ..."></textarea>
<input type="submit" value="Send" name="submit" id="submit">
</fieldset>
</form>
</article>
</div>
</section>
<!-- FOOTER -->
<footer>
<p>©2017. All Right Reserved.</p>
</footer>
// --- VARIABLES ---
$bgprimary: cadetblue
$bgdark: #111111
$colorprimary: cadetblue
$colorlight: snow
// --- BASE STYLES ---
*
padding: 0
margin: 0
box-sizing: border-box
body
font-family: 'Playfair Display', serif
background-color: $bgdark
padding-top: 4rem
// --- GLOBAL STYLES ---
section
padding: 2.7rem 0 0.5rem 0
article
width: 100%
padding: 1rem
.row
max-width: 35rem
margin: 0 auto 0 auto
// --- TYPOGRAPHY ---
h2
color: $colorprimary
font-size: 1.4rem
margin-bottom: 1.5rem
text-transform: uppercase
a
display: inline-block
padding: 0 1rem
text-decoration: none
color: white
font-weight: 900
// --- NAVIGATION ---
i#toggle
display: inline-block
font-size: 1.7rem
.menu
position: fixed
top: 0
left: 0
width: 100%
background-color: $bgprimary
height: 4rem
line-height: 4rem
font-size: 1.3rem
font-weight: 700
z-index: 50
ul
color: $colorprimary
list-style-type: none
transition: all 0.5s ease
background-color: rgba(21, 21, 21, 0.85)
li
height: 2.7rem
line-height: 2.7rem
border-bottom: 1px solid $colorprimary
a
display: block
padding-left: 3rem
color: $colorprimary
font-size: 1.2rem
transition: all 0.5s ease
a:hover
padding-left: 4.2rem
.hidden
display: none
// --- HEADER ---
header
background-color: #212121
background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),url(https://www.sketchuptextureclub.com/public/texture_m/0024-wood-wall-panels-texture-seamless.jpg)
background-position: center
background-attachment: fixed
width: 100%
padding: 7rem 0 9rem 0
position: relative
@media (min-width: 800px)
padding: 9rem 0 11rem 0
@media (min-width: 1025px)
padding: 11rem 0 14rem 0
.header-content
width: 100%
position: absolute
left: 50%
top: 50%
transform: translate(-50%, -50%)
-webkit-transform: translate(-50%, -50%)
text-align: center
h1
font-size: 2.5rem
text-transform: uppercase
color: snow
span
color: brown
font-size: 3.1rem
h3
font-size: 1.1rem
text-transform: uppercase
color: $colorlight
section p
color: white
font-size: 1.05rem
margin-bottom: 1rem
font-family: 'Signika', sans-serif
line-height: 135%
font-weight: 300
// --- ABOUT SECTION ---
#about article:after
content: ""
display: block
text-align: center
font-size: 1rem
color: $colorprimary
// --- PORTFOLIO SECTION ---
.panel
margin-bottom: 0.5rem
.panel-head
padding: 0.5rem
margin-bottom: 0.5rem
border: 1px solid $colorlight
position: relative
h3
color: $colorprimary
i.fa
display: inline-block
position: absolute
right: 1rem
top: 30%
color: $colorlight
.panel article
display: none
h4
color: $colorprimary
margin-bottom: 0.5rem
.hide
display: none
// --- CONTACT SECTION ---
#contact
padding-bottom: 3rem
form
box-sizing: border-box
font-family: 'Signika', sans-serif
fieldset
padding: 1rem
border: 1px solid $colorlight
legend
color: $colorlight
padding: 0 10px
#contact label
color: cadetblue
#contact input,
#contact label
display: block
width: 100%
padding: 5px
margin: 0
font-size: 1rem
#contact input
color: #212121
background-color: gainsboro
textarea
background-color: gainsboro
width: 100%
padding: 5px
font-size: 1rem
input::placeholder
color: teal
font-size: 1rem
textarea::placeholder
font-size: 1rem
color: teal
textarea::-ms-input-placeholder
font-size: 1.2rem
color: teal
input#submit
margin-top: 1rem
padding: 0.7rem 0
background-color: $bgprimary
color: white
font-family: 'Playfair Display', serif
font-size: 1.1rem
font-weight: 900
border: none
transition: all 0.25s ease
input#submit:hover
background-color: darken( $bgprimary, 10% )
// --- FOOTER ---
footer
background-color: #050505
padding: 2rem 0
color: snow
text-align: center
footer p
font-size: 0.9rem
// Top Navigation
$('.menu').click(function() {
$('#toggle').toggleClass('fa-toggle-off');
$('#toggle').toggleClass('fa-toggle-on');
//$('.menu ul').toggleClass('hidden');
$('.menu ul').slideToggle('200');
});
// Portfolio Panels
$('.panel-head').click(function() {
$(this).next().slideToggle();
if($(this).children('i').hasClass('fa-plus-circle')) {
$(this).find('i').removeClass('fa-plus-circle').addClass('fa-minus-circle');
} else {
$(this).find('i').removeClass('fa-minus-circle').addClass('fa-plus-circle');
}
});
Also see: Tab Triggers