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.
<!-- top navigation header START -->
<nav class="navbar navbar-expand-md bg-dark navbar-dark">
<!-- unused: fixed-top-->
<!-- Brand -->
<a class="navbar-brand" href="/Default.aspx">
<img id="logo" alt="Logo" src="https://picsum.photos/id/774/50/50">
<span>Bootstrap 4 (layout w/content)</span>
</a>
<!-- Toggler/collapsible Button -->
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<!-- Navbar links -->
<div class="collapse navbar-collapse justify-content-end" id="collapsibleNavbar">
<ul class="navbar-nav">
<li class="nav-item"> <a class="nav-link" href="#">Home</a> </li>
<!-- Dropdown -->
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-toggle="dropdown">
About Us
</a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="#">Meetings meetings meetings</a>
<a class="dropdown-item" href="#">Subscriptions</a>
<a class="dropdown-item" href="#">History</a>
</div>
</li>
<li class="nav-item"> <a class="nav-link" href="#blahblah">Click-to-scroll</a> </li>
</ul>
</div>
</nav>
<!-- top navigation header END -->
<!-- START of container section -->
<div class="container">
<!-- START of content sections -->
<!-- ========================= -->
<!-- Jumbotron content section-->
<div class="row">
<div class="col text-center">
column JUMBOTRON section
</div>
</div>
<!-- main page content and sidebar box -->
<div class="row">
<!-- sidebar navigation section -->
<!-- auto-hides when small screen -->
<div class="col sidebar_nav d-none d-md-block text-center">
column SIDEBAR-NAV (hide this section on medium and smaller screens)
<div class="col sidenavbar">
<a href="https://getbootstrap.com/docs/3.4/getting-started/">BS3 docs style sidebar-nav</a> (should always stick to top regardless of scrolling down page)
</div>
</div>
<!-- main content section -->
<div class="col text-center">
<h2>Column MAIN CONTENT</h2>
<h1>Nonummy Platea Nunc Dictum Pretium Per</h1>
<h2>Dictumst Posuere Vestibulum</h2>
<p>Purus ultricies accumsan faucibus Tempor montes nulla nulla augue laoreet, libero porttitor venenatis ac Lorem tortor malesuada. Sollicitudin diam feugiat gravida. Magna curabitur. Fusce vulputate platea imperdiet suscipit, fermentum magnis magnis purus sodales habitasse sodales nunc volutpat, ut natoque. Hendrerit magna nullam interdum porttitor tempor dictum tortor mattis donec potenti arcu morbi pharetra sem leo nullam commodo tellus. Congue leo dictum lectus penatibus feugiat pulvinar, maecenas eu turpis, posuere sagittis sapien, malesuada eleifend praesent pede pulvinar massa mollis sagittis per ullamcorper suscipit luctus. Adipiscing amet.</p>
<p>Quisque leo pharetra porttitor cras pede nibh pretium fermentum ridiculus luctus pretium felis enim sociis volutpat laoreet arcu auctor duis natoque convallis. Egestas venenatis fringilla leo congue, porttitor laoreet tempus Cras porta. Nisi lacus facilisis nisl ullamcorper justo hymenaeos integer libero lobortis class tempor nulla volutpat neque dui mus. Proin nec nostra metus tempus suscipit, sagittis eget. Cras, elementum sagittis vel dis venenatis pretium. Commodo posuere molestie nunc facilisis. Leo. Proin mi morbi est. Montes eget ornare aliquam lacus lacus per habitasse lacinia faucibus laoreet, vehicula eget. Pharetra mauris. Mus taciti non dis sem ultricies dis egestas duis ligula sem vitae potenti. Pellentesque maecenas cum proin hendrerit at et penatibus arcu interdum velit ornare nascetur sociosqu ac gravida ridiculus class velit leo potenti purus ultrices porttitor vulputate potenti nisi sociosqu sollicitudin fames Viverra fames ultrices rhoncus dolor arcu. Curabitur rutrum sapien netus eros. Pulvinar mus est Urna rhoncus.</p>
<h2 id="blahblah">Blah blahhh blabalabala</h2>
<p>Mi mollis morbi nostra euismod sit. Duis nulla cubilia at orci mollis hymenaeos gravida sodales imperdiet suscipit lacus. Luctus mauris aliquet justo. Velit Lobortis curae; auctor ac. Est, mauris velit commodo leo rutrum senectus eget nonummy penatibus iaculis cum maecenas hendrerit in et ipsum. Sociis ut aliquam venenatis. Tempus. Blandit. Montes cum accumsan Ultrices ligula dapibus Sagittis. Tempus lectus pellentesque at nunc donec ipsum sagittis potenti. Ad.</p>
</div>
</div>
<!-- Carousel content section -->
<div class="row">
<div class="col text-center">
column CAROUSEL section
</div>
</div>
<!-- cards content section -->
<div class="row">
<div class="col text-center">
column CARD 1 OF 3 section
</div>
<div class="col text-center text-center">
column CARD 2 OF 3 section
</div>
<div class="col text-center">
column CARD 3 OF 3 section
</div>
</div>
<!-- END of content sections -->
</div>
<!-- END of container section -->
<!-- footer section -->
<div class="footer_section text-center text-white bg-dark">
<p>FOOTER section</p>
/* smooth scrolling with JS code */
html {
scroll-behavior: smooth;
}
/* styling of content boxes */
.col {
background-color: #FEF0B2;
border-radius: 0.3rem;
margin: 0.1rem;
padding: 1rem;
}
/* styling of sidebar-navigation section */
.sidebar_nav {
background-color: #F84F7F;
border-radius: 0.3rem;
margin: 0.1rem;
padding: 1rem;
}
/* styling of footer section */
.footer_section {
border-radius: 0.3rem;
margin: 0.1rem;
padding: 0.5rem;
}
/* sidebar navigation stays on top while scrolling */
.sidenavbar{
position:-webkit-;
position:sticky;
top:0;
}
$(document).ready(function(){
// Add smooth scrolling to all links
$("a").on('click', function(event) {
// Make sure this.hash has a value before overriding default behavior
if (this.hash !== "") {
// Prevent default anchor click behavior
event.preventDefault();
// Store hash
var hash = this.hash;
// Using jQuery's animate() method to add smooth page scroll
// The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 800, function(){
// Add hash (#) to URL when done scrolling (default click behavior)
window.location.hash = hash;
});
} // End if
});
});
Also see: Tab Triggers