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.
<html>
<head>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<header>Header</header>
<article>
<section id="section-1">
<h1>Section 1</h1>
<p>Post launch agile follow up digest copy deck client-facing streamline. Take a stab at it copy deck affiliate marketing cohesive SEO. Good fit pivot game plan discovery on your plate target audience plow through functionality internally. In the queue streamline traction whiteboard optimize. Push the envelope post launch credentials retainer. Dynamic cross platform third party implementation mission statement gear up strategic partners leverage reach. Lean retainer ROI discovery gear up. Affiliate marketing take a stab at it channels deliverables post launch look and feel gear up. Tweak synergy kick-off leverage.</p>
</sections>
<section id="section-1a">
<h2>Section 1a</h2>
<p>Okay, yeah I think the word program I used to design that doesn't have the strongest pixels. The government blocked javascript or something... That's why my Yahoo mail isn't coming onto my phone. Make the logo bigger. I want them to know what website they're on. Looks good, but... We may want to put a sunrise on it.</p>
<p>We think it would be better to stick with darker bright colors. Instead of the boring image of a "hand" when a client clicks on something, please make it a small (but friendly) garden insect - e.g. a butterfly, grasshopper, or hummingbird. Please avoid insects with negative connotations, e.g. a slug, caterpillar, or hawk. Looks good, but... Hey, I know it's been a while, but do you happen to know our office WiFi password? We may want to put a sunrise on it. Looks good, but... Well I don't like the pages who has loading when you get to the website, I don't want to have to wait.</p>
<p>I don't like circles. We were hoping to see some more design in the design. None of our hyperlinks are working. We don't know where it's trying to link to. We just underlined the text and were not further prompted. Look, I've been using the internet since the 90's... So I could probably design this site myself. You're more like a second opinion. I like it but can you change it? We may want to put a sunrise on it. Overall perhaps we could somehow exchange some color for dimension/depth/texture? And by dimension/depth/texture I just mean "3d-ness" of the boxes or the buttons.</p>
</section>
<a class="page-anchor"></a>
<section id="section-1b">
<h2>Section 1b</h2>
<p>Organic value-add pipeline target audience internally lead generation. Dynamic gear up high-level ROI whiteboard. Copy deck high-level regroup cohesive next level proximity transparent ETA. Above the fold responsive behavior discovery traction.</p>
<p>User persona pipeline bandwidth SEO. Conversion mobile-first traction proximity consolidate client-facing. Plow through traction SEO synergy value creation reach target audience mission statement synergy. Post launch B2B conversion lean game plan value creation channels leverage dev environment.</p>
<p>Credentials affiliate marketing ETA above the fold value proposition push the envelope. Channels next steps SEO API digest mission statement discovery. Channels retainer pivot implementation value proposition post launch conversion plow through. Fluid dev environment lead generation bandwidth usability mock up tweak pivot. Proximity next steps mobile-first cohesive organic reach credentials regroup. Game changer agile game plan game changer segment. Heads down above the fold game changer proposed fluid ROI onboarding. Mock up game changer follow up value proposition SEO. Heads down whiteboard high-level lead generation look and feel.</p>
</section>
<section id="section-2">
<h1>Section 2</h1>
<p>I'll know it when I see it. We're just not seeing that "ka-pow" factor. I'm not sure about the colour that you've used for the background, I guess it looks OK on screen but when I print it on our office printer it kinda reminds me of a pair of corduroys I had as a child. Can you make the logo bigger?</p>
<p>The design needs to be less liney. There are too many lines. Hey, I know it's been a while, but do you happen to know our office WiFi password? The design needs to be less liney. There are too many lines. Can we add transitions like in PowerPoint?</p>
<p>We think it would be better to stick with darker bright colors. I did this at home with Microsoft Paint. Can you use a "clear" background on my website? No, not white. Transparent. I think the internet is down. We want it to look very "Web 2.0". I don't like circles. We're just not seeing that "ka-pow" factor. Let's get a QR code of our website and add it on our website.</p>
</section>
<section id="section-3">
<h1>Section 3</h1>
<p>Third party lead generation client-facing onboarding next level good fit segment. OLA reach leverage push the envelope organic mobile-first. Follow up CTA mock up pivot ecosystem lead generation look and feel. Strategic partners SEO B2B traction next level strategic partners value creation plow through mission statement. User persona tweak prototype ramp up B2B optimize prototype proposed. Pipeline above the fold synergy cohesive streamline game changer. In the queue organic next level digest. Streamline API dynamic .</p>
<p>Proposed tweak on your plate synergy next steps discovery. Mock up third party proximity follow up. Value creation dynamic cohesive in the queue. Reach heads down tackle it strategic partners lean push the envelope value proposition high-level. Scope out functionality tweak flesh out third party.</p>
<p>Onboarding responsive behavior innovation optimize. EOD whiteboard heads down traction ecosystem ROI game changer. Value-add value proposition game plan copy deck. Proposed hackathon good fit value-add. CTA usability retainer ecosystem strategic partners gear up ecosystem EOD. Game plan ROI organic EOD internally. Discovery copy deck whiteboard game changer ecosystem ETA lead generation onboarding strategic engagement.</p>
</section>
<section id="section-4">
<h1>Section 4</h1>
<p>SEO proximity conversion streamline regroup whiteboard. Deliverables onboarding pivot SEO scope out reach B2B optimize. Next level segment mission statement reach third party onboarding. Cross platform high-level strategic engagement gear up copy deck ETA B2B cross platform plow through. Pivot game plan retainer ETA flesh out copy deck whiteboard pivot post launch. Lean client-facing value proposition look and feel ROI. Lead generation post launch high-level usability.</p>
<p>Traction proximity consolidate strategic engagement lead generation ecosystem segment next level discovery. Third party strategic engagement implementation traction client-facing cross platform third party. Fluid pivot value creation post launch. Optimize bandwidth cross platform traction organic bandwidth optimize proposed. Organic leverage ramp up mock up dev environment OLA ROI.</p>
<p>Take a stab at it cross platform kick-off mobile-first high-level push the envelope onboarding mission statement. Post launch usability on your plate cross platform channels above the fold on your plate. Lean optimize synergy responsive behavior regroup prototype user persona. Leverage fluid ETA consolidate take a stab at it. Ramp up fluid transparent gear up dynamic. Scope out strategic partners mock up reach above the fold.</p>
</div>
</article>
<nav id="sidebar">
<h1>Contents</h1>
<ul class="sidebar-nav">
<li><a href="#section-1">Section 1</a>
<ul>
<li><a href="#section-1a">Section 1a</a></li>
<li><a href="#section-1b">Section 1b</a></li>
</ul>
</li>
<li><a href="#section-2">Section 2</a></li>
<li><a href="#section-3">Section 3</a></li>
<li><a href="#section-4">Section 4</a></li>
</ul>
</nav>
</body>
</html>
body, html {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
h2 {
font-size: 1em
}
header {
width: 100%;
height: 75px;
background-color: #CCC;
}
article {
display: inline-block;
width: 60%;
}
ul {
padding: 0;
margin: 0 0 0 15px;
list-style-type: none;
}
.current {
color: #000;
text-decoration: none;
}
#sidebar {
display: inline-block;
position: absolute;
right: 10%;
top: 175px;
width: 20%;
padding: 20px;
border: 1px solid black
}
#sidebar.is-fixed {
position: fixed;
top: 100px;
}
$(window).resize(function() {
var anchors = $('section').map(function(i) {
return {
height: $(this).position().top,
link: $('a[href="#' + $(this).attr('id') + '"]')
};
});
var navLength = anchors.length;
$(window).scroll(function(){
var scrollPosition = $(window).scrollTop();
if(scrollPosition >= 75){
$('#sidebar').addClass('is-fixed');
} else {
$('#sidebar').removeClass('is-fixed');
}
for (var i = navLength - 1; i >= 0; i--) {
if (scrollPosition >= anchors[i].height - 10) {
$('.sidebar-nav a').removeClass('current');
anchors[i].link.addClass('current');
return;
}
}
});
}());
Also see: Tab Triggers