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.
<html lang="en">
<html>
<head>
<title>Technical Documentation</title>
<link rel="http://fonts.googleapis.com/css?family=Merienda+One" href="stylesheet"/>
<meta charset="utf-8"/>
<link rel="stylesheet" href="index.css"/>
</head>
<body>
<header id="body-header">Zionnaire Tutorials</header>
<nav id="navbar">
<header>JS Documentation</header>
<ul>
<li>
<a class="nav-link" href="#Introduction">Introduction</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="#JavaScript_and_Java">JavaScript and Java</a>
</li>
<li>
<a class="nav-link" href="#Hello_world">Hello world</a>
</li>
<li>
<a class="nav-link" href="#Variables">Variables</a>
</li>
<li>
<a class="nav-link" href="#Declaring_variables">Declaring variables</a>
</li>
<li>
<a class="nav-link" href="#if_else_statement">if else statement</a>
</li>
<li>
<a class="nav-link" href="#Reference">Reference</a>
</li>
</ul>
</nav>
</div>
<main id="main-doc">
<section id="Introduction" class="main-section">
<header>Introduction</header>
<article>
<p>JavaScript is a cross-platform, object-oriented scripting language.
It is a small and lightweight language.
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 Array,
Date, and Math, 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>
</article>
</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>
<p></p>
<code></code>
<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>
</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>
</article>
</section>
<section id="Hello_world" class="main-section">
<header>Hello world</header>
<article>
<p>To get started with writing JavaScript, open the Scratchpad and write your first
"Hello world" JavaScript code:
</p>
<code>function greetMe(yourName) { alert("Hello " + yourName); }
greetMe("World");</code>
<p>Select the code in the pad and hit Ctrl+R to watch it unfold in your browser!</p>
</article>
</section>
<section id="Variables" class="main-section">
<header>Variables</header>
<article>
<p>You use variables as symbolic
names for values in your application.
The names of variables, called identifiers,
conform to certain rules.
</p>
<p>A JavaScript identifier must start with a letter,
underscore (_), or dollar sign ($); subsequent
characters can also be digits (0-9). Because
JavaScript is case sensitive, letters include
the characters "A" through "Z" (uppercase) and
the characters "a" through "z" (lowercase).
</p>
<p>You can use ISO 8859-1 or Unicode letters such
as å and ü in identifiers. You can also use the
Unicode escape sequences as characters in identifiers.
Some examples of legal names are Number_hits, temp99, and _name.
</p>
</article>
</section>
<section id="Declaring_variables" class="main-section">
<header>Declaring variables</header>
<article>
<p>You can declare a variable in three ways:
</p>
<p>With the keyword var. For example,
</p>
<code>var x = 42.</code>
<p>This syntax can be used to declare both
local and global variables.
</p>
<p>By simply assigning it a value. For example,</p>
<code>x = 42.</code>
<p>This always declares a global variable. It generates a strict JavaScript warning.
You shouldn't use this variant.
</p>
<p>With the keyword let. For example,</p>
<code>let y = 13.</code>
<p>This syntax can be used to declare a block scope local variable.
See Variable scope below.
</p>
</article>
</section>
<section id="if_else_statement" class="main-section">
<header>if else statement</header>
<article>
<p>Use the if statement to execute a statement if a logical condition is true.
Use the optional else clause to execute a statement if the condition is false.
An if statement looks as follows:
</p>
<code>if (condition) { statement_1; } else { statement_2; }</code>
<p>condition can be any expression that evaluates to true or false.
See Boolean for an explanation of what evaluates to true and false.
If condition evaluates to true, statement_1 is executed; otherwise,
statement_2 is executed. statement_1 and statement_2 can be any statement,
including further nested if statements.
</p>
<p>You may also compound the statements using else if to have multiple conditions
tested in sequence, as follows:
</p>
<code>if (condition_1) { statement_1; } else if (condition_2) { statement_2;
} else if (condition_n) { statement_n; } else { statement_last; }
</code>
<p>In the case of multiple conditions only the first logical
condition which evaluates to true will be executed.
To execute multiple statements, group them within a
block statement ({ ... }) . In general, it's good practice
to always use block statements, especially when nesting if
statements:
</p>
<code>if (condition) { statement_1_runs_if_condition_is_true;
statement_2_runs_if_condition_is_true; } else {
statement_3_runs_if_condition_is_false;
statement_4_runs_if_condition_is_false; }
</code>
<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>
</article>
</section>
</section>
<section id="Reference" class="main-section">
<header>Reference</header>
<article>
<ul>
<li>All the documentation in this page is taken from MDN</li>
</ul>
</article>
</section>
</main>
<footer>
<p> Zionnaire Concepts</p>
<address>Zionnaire Plaza, Hilton Drive, Houston,
23458; Crescents Creek.
</address>
</footer>
</body>
</html>
</html>
html, body {
min-width: 290px;
color: #4d4e53;
background-color: #ffffff;
font-family: 'Open Sans', Arial, sans-serif;
line-height: 1.5;
}
body{
display: block;
margin: 8px;
}
#body-header {
background-color: goldenrod;
text-align: center;
display: block;
margin: 10px;
width: 100%;
position: fixed;
}
nav {
position: fixed;
max-width: fit-content;
float: left;
overflow-y: scroll;
width: 100%;
scroll-behavior: smooth;
background-color: yellowgreen;
}
@media screen and (width: 400px) {
nav {
margin: auto;
height: 100%;
width: 100%;
scroll-margin: smooth;
}
}
@media screen and (max-width: 815px) {
nav {
position: fixed;
padding: 0;
background-color: white;
position: absolute;
top: 0;
margin: 0;
max-height: 275px;
border: none;
z-index: 1;
width: 100%;
border-bottom: 2px solid;
overflow-y: scroll;
overflow-x: hidden;
scroll-margin: auto;
}
}
#navbar {
min-width: 290px;
height: 100%;
left: 0px;
position: fixed;
width: 100%;
background-color: goldenrod;
}
header {
margin: 10px;
color: black;
font-size: 1.8em;
text-align: center;
position: relative;
}
#navbar ul {
padding: 0;
background-color: #f1f1f1;
}
#navbar li {
color: #4d4e53;
border-top: 1px solid;
list-style: none;
position: relative;
}
li {
display: list-item;
text-align: -webkit-match-parent;
}
li a:hover {
background-color: yellowgreen;
color: #fff;
pointer-events: visiblePainted;
}
#navbar a{
display: block;
padding: 10px 30px;
color: #4d4e53;
text-decoration: none;
cursor: pointer;
}
ul {
display: block;
list-style-type: disc;
margin-block-start: 1em;
margin-block-end: 1em;
margin-inline-start: 0px;
margin-inline-end: 0px;
padding-inline-start: 40px;
}
main{
margin: -20px 0 10px 300px;
background-color: yellowgreen;
}
#main-doc {
padding: 20px;
margin-bottom: 0px;
background-color: whitesmoke;
text-align: justify;
font-size: larger;
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
}
@media screen and (width: 400px) {
#main-doc {margin-left: -10px}
}
@media screen and (max-width: 815px){
#main-doc {
position: relative;
margin-top: 270px;
}
}
section, article, nav, p, main {
display: block;
}
#main-doc header {
text-align: left;
margin: 25px 0 10px 0;
}
section article {
color:#4d4e53;
margin: 15px;
font-size: 0.96em;
}
p{
margin-block-start: 1em;
margin-block-end: 1em;
margin-inline-start: 0px;
margin-inline-end: 0px;
}
code{
background-color: lightgray;
overflow-x: auto;
}
footer{
background-color: goldenrod;
display: block;
text-align: center;
padding: 0;
margin: 0;
font-size: 1rem;
width: 100%;
position: relative;
}
footer p{
padding: 5px 0;
margin: 10px 0 20px 0;
}
address {
margin-top: -15px;
}
// !! IMPORTANT README:
// You may add additional external JS and CSS as needed to complete the project, however the current external resource MUST remain in place for the tests to work. BABEL must also be left in place.
/***********
INSTRUCTIONS:
- Select the project you would
like to complete from the dropdown
menu.
- Click the "RUN TESTS" button to
run the tests against the blank
pen.
- Click the "TESTS" button to see
the individual test cases.
(should all be failing at first)
- Start coding! As you fulfill each
test case, you will see them go
from red to green.
- As you start to build out your
project, when tests are failing,
you should get helpful errors
along the way!
************/
// PLEASE NOTE: Adding global style rules using the * selector, or by adding rules to body {..} or html {..}, or to all elements within body or html, i.e. h1 {..}, has the potential to pollute the test suite's CSS. Try adding: * { color: red }, for a quick example!
// Once you have read the above messages, you can delete all comments.
Also see: Tab Triggers