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 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.
<nav id="navbar">
<header><strong>Javascript Documention</strong></header>
<ul>
<li id="wc"><a class="nav-link" href="#what_is_javascript?">What Is Javascript?</a></li>
<li><a class="nav-link" href="#what_you_should_already_know">What You Should Already Know</a></li>
<li><a class="nav-link" href="#where_to_find_javascript_information">Where To Find Javascript Information</a></li>
<li><a class="nav-link" href="#javascript_and_java">Javascript And Java</a></li>
<li><a class="nav-link" href="#javascript_and_the_ecmascript">Javascript And The ECMAScript</a></li>
<li><a class="nav-link" href="#getting_started_with_javascript">Getting Started With Javascript</a></li>
<li><a class="nav-link" href="#data_types">Data Types</a></li>
<li id="dc"><a class="nav-link" href="#declaring_variables">Declaring Variables</a></li>
</ul>
</nav>
<main id="main-doc">
<section id="what_is_javascript?" class="main-section">
<header>What Is Javascript?</header>
<p>JavaScript is a cross-platform, object-oriented scripting language used to make webpages interactive (e.g. having complex animations, clickable buttons, popup menus, etc.). There are also more advanced server side versions of JavaScript such as Node.Js which allow you to add more functionality to a website than simply downloading files (such as realtime collaboration between multiple computers). Inside a host environment (for example, a web browser), JavaScript can be connected to the objects of its environment to provide programmatic control over them.</p>
<p>JavaScript contains a standard library of objects, such as <code>Array</code> <code>Date</code> and <code>Math</code> and a core set of language elements such as operators, control structures, and statements. Core JavaScript can be extended for a variety of purposes by supplementing it with additional objects; for example:</p>
<ul>
<li>Client-side JavaScript extends the core language by supplying objects to control a browser and its Document Object Model (DOM). For example, client-side extensions allow an application to place elements on an HTML form and respond to user events such as mouse clicks, form input, and page navigation.</li>
<li>Server-side JavaScript extends the core language by supplying objects relevant to running JavaScript on a server. For example, server-side extensions allow an application to communicate with a database, provide continuity of information from one invocation to another of the application, or perform file manipulations on a server.</li>
</ul>
<p>This means that in the browser, JavaScript can change the way the webpage (DOM) looks. And, likewise, Node.js JavaScript on the server can respond to custom requests from code written in the browser</p>
</section>
<section id="what_you_should_already_know" class="main-section">
<header>What you should already know</header>
<p>This guide assumes you have the following basic background:</p>
<ul>
<li>A general understanding of the Internet and the World Wide Web (WWW).</li>
<li>Good working knowledge of HyperText Markup Language (HTML).</li>
<li>Some programming experience. If you are new to programming, try one of the tutorials linked on the main page about JavaScript.</li>
</ul>
</scetion>
<section id="where_to_find_javascript_information" class="main-section">
<header>Where To Find JavaScript Information</header>
<article>
<p>The JavaScript documentation on MDN includes the following:</p>
<ul>
<li>Learn Web Development provides information for beginners and introduces basic concepts of programming and the Internet.</li>
<li>JavaScript Guide (this guide) provides an overview about the JavaScript language and its objects.</li>
<li>JavaScript Reference provides detailed reference material for JavaScript.
If you are new to JavaScript, start with the articles in the learning area and the JavaScript Guide. Once you have a firm grasp of the fundamentals, you can use the JavaScript Referenceto get more details on individual objects and statements.
</li>
</ul>
</article>
</section>
<section id="javascript_and_java" class="main-section">
<header>JavaScript and Java</header>
<article>
<p>JavaScript and Java are similar in some ways but fundamentally different in some others. The JavaScript language resembles Java but does not have Java's static typing and strong type checking. JavaScript follows most Java expression syntax, naming conventions and basic control-flow constructs which was the reason why it was renamed from LiveScript to JavaScript.</p>
<p>In contrast to Java's compile-time system of classes built by declarations, JavaScript supports a runtime system based on a small number of data types representing numeric, Boolean, and string values. JavaScript has a prototype-based object model instead of the more common class-based object model. The prototype-based model provides dynamic inheritance; that is, what is inherited can vary for individual objects. JavaScript also supports functions without any special declarative requirements. Functions can be properties of objects, executing as loosely typed methods.</p>
<p>JavaScript is a very free-form language compared to Java. You do not have to declare all variables, classes, and methods. You do not have to be concerned with whether methods are public, private, or protected, and you do not have to implement interfaces. Variables, parameters, and function return types are not explicitly typed.</p>
<p>Java is a class-based programming language designed for fast execution and type safety. Type safety means, for instance, that you can't cast a Java integer into an object reference or access private memory by corrupting Java bytecodes. Java's class-based model means that programs consist exclusively of classes and their methods. Java's class inheritance and strong typing generally require tightly coupled object hierarchies. These requirements make Java programming more complex than JavaScript programming.</p>
<p>In contrast, JavaScript descends in spirit from a line of smaller, dynamically typed languages such as HyperTalk and dBASE. These scripting languages offer programming tools to a much wider audience because of their easier syntax, specialized built-in functionality, and minimal requirements for object creation.</p>
</article>
</section>
<section id="javascript_and_the_ecmascript" class="main-section">
<header>JavaScript and the ECMAScript</header>
<article>
<p>JavaScript is standardized at Ecma International — the European association for standardizing information and communication systems (ECMA was formerly an acronym for the European Computer Manufacturers Association) to deliver a standardized, international programming language based on JavaScript. This standardized version of JavaScript, called ECMAScript, behaves the same way in all applications that support the standard. Companies can use the open standard language to develop their implementation of JavaScript. The ECMAScript standard is documented in the ECMA-262 specification. See New in JavaScript to learn more about different versions of JavaScript and ECMAScript specification editions.</p>
<p>The ECMA-262 standard is also approved by the ISO (International Organization for Standardization) as ISO-16262. You can also find the specification on the Ecma International website. The ECMAScript specification does not describe the Document Object Model (DOM), which is standardized by the World Wide Web Consortium (W3C) and/or WHATWG (Web Hypertext Application Technology Working Group). The DOM defines the way in which HTML document objects are exposed to your script. To get a better idea about the different technologies that are used when programming with JavaScript, consult the article JavaScript technologies overview.</p>
</article>
</section>
<section id="getting_started_with_javascript" class="main-section">
<header>Getting started with JavaScript</header>
<article>
<p>Getting started with JavaScript is easy: all you need is a modern Web browser. This guide includes some JavaScript features which are only currently available in the latest versions of Firefox, so using the most recent version of Firefox is recommended.</p>
</article>
</section>
<section id="data_types" class="main-section">
<header>Data Types</header>
<article>
<p>The latest ECMAScript standard defines eight data types:</p>
<ul>
<li>Six data types that are primitives:
<ul>
<li>Boolean. <code>true</code> and <code>false.</code></li>
<li>null. A special keyword denoting a null value. Because JavaScript is case-sensitive, <code>null</code> is not the same as <code>Null</code>, <code>NULL</code>, or any other variant</li>
<li>Symbol (new in ECMAScript 2015). A data type whose instances are unique and immutable</li>
<li>String. A sequence of characters that represent a text value. For example: "Howdy"</li>
<li>BigInt. An integer with arbitrary precision. For example: <code>9007199254740992n.</code></li>
<li>Number. An integer or floating point number. For example: <code>42</code> or <code>3.14159</code>.</li>
</ul>
</li>
<li>and Object</li>
</ul>
<p>Although these data types are relatively few, they enable you to perform useful functions with your applications. <code>Objects</code> and <code>functions</code> are the other fundamental elements in the language. You can think of objects as named containers for values, and functions as procedures that your application can perform.</p>
</article>
</section>
<section id="declaring_variables" class="main-section">
<header>Declaring Variables</header>
<article>
<p>You can declare a variable in two ways:</p>
<ul>
<li>With the keyword <code>var</code> For example, <code>var x = 42.</code> This syntax can be used to declare both local and global variables, depending on the execution context.</li>
<li>With the keyword <code>const</code> or <code>let</code> For example, <code>let y = 13.</code> This syntax can be used to declare a block-scope local variable. See Variable scope below.</li>
</ul>
</article>
</section>
</main>
body, html{
height: 100%;
font-family: 'lucida bright', 'Lucida Sans', 'Lucida Sans Regular';
line-height: 1.5;
color: black;
background: rgb(231, 231, 231);
}
#navbar{
position: fixed;
height: 100%;
top: 0;
left:0;
width: 312px;
border-right: 1.5px solid;
}
#navbar header{
text-align: center;
font-size: 1.5rem;
/*
border-bottom: 1px dotted;
*/
padding: 5px;
}
#navbar ul{
height: 100%;
padding: 0;
margin: 0;
}
#navbar ul li {
list-style: none;
border: 1px solid;
border-radius: 5px;
background: rgb(201, 198, 192);
left: 0;
width: 100%;
}
li a{
color: rgb(24, 22, 22);
display: block;
width: 100%;
padding: 15px 15px;
text-decoration: none;
}
#main-doc{
position: relative;
margin-left: 315px;
}
#main-doc header{
font-size: 2rem;
}
section li{
background: rgb(188, 192, 180);
list-style: none;
}
code{
font-size: 1.2rem;
background: rgb(119, 142, 151);
border-radius: 2px;
}
@media only screen and (max-width: 800px){
#navbar{
position: absolute;
width: 90%;
border: none;
margin-left: 20px;
}
#main-doc {
position: relative;
margin-left: 0px;
margin-top: 500px;
}
}
Also see: Tab Triggers