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.
<div id="links">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Righteous&display=swap" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inconsolata:wght@700&family=Righteous&display=swap" rel="stylesheet">
</div>
<head >
<h1 id="title">What made you want to learn to code?</h1>
</head>
<body>
<p id="description">As someone who is pursuing a degree in math and science, I was told that learning to code would look great on college applications and resumes, the only problem is that I have pretty much zero computer skills. I'm serious, I'm hopeless with pretty much any electronic device that you put in front of me. So, naturally, I was told that coding was way beyond my abilities. But I read a really interesting book where coding was used to do amazing things (can't remember the book title for the life of me), so I decided I would try it out (also I hate being told that I can't do something). So here I am, working towards a certificate in responsive web design, turns out I really like coding. And was wondering what brought other people to coding, so please answer a couple of questions and have a great day :)</p>
<form id="survey-form">
<p>Just the usual questions...</p>
<div class="short-text">
<label id="name-label" for="name">name
<input
type="text"
name="name"
id="name"
class="short-text"
placeholder="enter your name"
required/>
</label>
<label id="email-label" for="email">email
<input
type="email"
name="email"
id="email"
class="short-text"
placeholder="enter your email"
required/>
</label>
<label id="number-label" for="number">age
<input
type="number"
min="4"
max="120"
name="number"
id="number"
class="short-text"
placeholder="age"/>
</label>
<label for="gender">gender
<select id="dropdown" name="gender" class="options">
<option disabled selected value>select the best option</option>
<option value="female">female</option>
<option value="male">male</option>
<option value="nonbinary">nonbinary</option>
<option value="preferN/und">prefer not to say / undefined</option>
</select>
</label>
</div>
<div id="radio" for="education">
<p>What is your highest level of formal education?</p>
<label>
<input
type="radio"
value="high-school-or-below"
name="education"
class="options"/>
high school or below</label>
<label>
<input
type="radio"
value="trade-school"
name="education"
class="options"/>
trade school</label>
<label>
<input
type="radio"
value="undergraduate"
name="education"
class="options"/>
undergraduate school</label>
<label>
<input
type="radio"
value="graduate-school"
name="education"
class="options"/>
graduate school</label>
<label>
<input
type="radio"
value="none"
name="education"
class="options"/>
no formal education</label>
<label>
<input
type="radio"
value="prefer-not"
name="education"
class="options"/>
prefer not to say</label>
<label>
<input
type="radio"
value="other"
name="education"
class="options"/>
other</label>
</div>
<div id="checkboxs">
<p>What do you plan to use coding for?</p>
<label>
<input
type="checkbox"
value="personal"
class="options"/>
personal projects like making a blog or a game</label>
<label>
<input
type="checkbox"
value="mandatory-work"
class="options"/>
I need these skills to do my job</label>
<label>
<input
type="checkbox"
value="beneficial-work"
class="options"/>
I think these skills will benefit my career</label>
<label>
<input
type="checkbox"
value="fun"
class="options"/>
just for fun</label>
<label>
<input
type="checkbox"
value="unsure"
class="options"/>
not really sure...</label>
<label>
<input
type="checkbox"
value="other"
class="options"/>
some other reason</label>
</div>
</div>
<p>Use the space below to share your own introduction to coding and how far you have gotten so far.</p>
<label id="short-answer" class="more-info">
<textarea
class="more-info"
placeholder="type here"></textarea>
</label>
<button
type="submit"
id="submit">submit</button>
</form>
</body>
#title {
font-family: Righteous;
font-size: 3.5em;
color: #581845;
opacity: 0.9;
text-align: right;
margin: 30px 30px 80px 30px;
}
body {
background-image: url(https://ak.picdn.net/shutterstock/videos/17646406/thumb/1.jpg);
}
p {
font-family: Inconsolata;
font-size: 1.1em;
background-color: rgba(213, 213, 213,0.95);
padding: 10px 20px 10px 10px;
margin: 30px 508px 30px 80px;
border-color: rgb(217,160,146);
border-width: 4px;
border-style: solid;
}
.salmon-border {
border-color: rgb(217,160,146);
border-width: 10px;
border-style: solid;
}
#description{
margin: 30px 30px 30px 80px;
}
.short-text {
width: 60%;
padding: 5px 5px 5px 80px;
line-height: 28px;
display: block;
}
label {
background: rgba(80,80,80,0.55);
font-family: Inconsolata;
padding: 3px 3px 3px 3px;
display: block;
margin: 0px 200px 0px 20px;
}
// !! 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