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.
<div>
<h1>당신의 파스타, 재료를 골라주십시오</h1>
<h2>면을 골라주세요</h2>
<input type="radio" name="noodle" value="pasta" id="pasta" checked>
<label for="pasta">파스타(알 덴테)</label>
<input type="radio" name="noodle" value="tofunoodle" id="tofunoodle">
<label for="tofunoodle">두부면(좁은면)</label>
<input type="radio" name="noodle" value="tofunoodlew" id="tofunoodlew">
<label for="tofunooeldw">두부면(넓은면)</label>
<h2>소스를 골라주세요</h2>
<input type="radio" name="sauce" value="tomato" id="tomato" checked>
<label for="tomato">토마토</label>
<input type="radio" name="sauce" value="cream" id="cream">
<label for="cream">크림</label>
<input type="radio" name="sauce" value="rose" id="rose">
<label for="rose">로제</label>
<input type="radio" name="sauce" value="basil" id="basil">
<label for="basil">바질크림</label>
<h2>건더기를 골라주세요</h2>
<input type="checkbox" name="topping" value="닭찌찌살" id="chickenbreast" checked>
<label for="chickenbreast">닭찌찌살</label>
<input type="checkbox" name="topping" value="양파" id="onion" checked>
<label for="onion">양파</label>
<input type="checkbox" name="topping" value="목이버섯" id="woodear">
<label for="woodear">목이버섯</label>
<input type="checkbox" name="topping" value="양송이버섯" id="champignon">
<label for="champignon">양송이버섯</label>
<input type="checkbox" name="topping" value="새송이버섯" id="kingoyster">
<label for="kingpyster">새송이버섯</label>
<input type="checkbox" name="topping" value="베이컨" id="bacon">
<label for="bacon">베이컨</label>
<input type="checkbox" name="topping" value="관자" id="clam">
<label for="clam">관자</label>
<input type="checkbox" name="topping" value="차돌박이" id="beef">
<label for="beef">차돌박이</label>
<h2>다 골랐으면 눌러눌러! </h2>
<button id="readytocook">다 골랐다!</button>
</div>
<div id="pastaready"></div>
@font-face {
font-family: 'Ownglyph_meetme-Rg';
src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2402_1@1.0/Ownglyph_meetme-Rg.woff2') format('woff2');
font-weight: normal;
font-style: normal;
}
body {
font-family: 'Ownglyph_meetme-Rg';
font-size: 14pt;
}
div {
width: 1024px;
margin: 0 auto;
}
label {
font-size: 16pt;
}
input {
margin: 5px 5px 15px 5px;
vertical-align: middle;
}
input[type="radio"] {
appearance: none;
width: 1.5em;
height: 1.5em;
border: 1px solid #aaaaaa;
border-radius: 50%;
transition: 0.2s;
}
input[type="radio"]:checked {
border: none;
}
input[type="radio"]:checked::after {
content:'❤️';
}
input[type="checkbox"] {
appearance: none;
width: 1.5em;
height: 1.5em;
border: 1px solid #aaaaaa;
border-radius: 50%;
transition: 0.2s;
}
input[type="checkbox"]:checked {
border: none;
}
input[type="checkbox"]:checked::after {
content:'❤️';
}
button {
width: 180px;
height: 60px;
border: none;
background-color: #f7cac9;
font-family: 'Ownglyph_meetme-Rg';
font-size: 20pt;
}
const pastaNoodle = document.getElementsByName("noodle");
const pastaSauce = document.getElementsByName('sauce');
const pastaTopping = document.getElementsByName('topping');
const readytocook = document.querySelector("#readytocook");
const pastaReady = document.querySelector("#pastaready");
const pastapick = document.createElement("p");
let noodle = "";
let sauce = "";
let topping = [];
readytocook.addEventListener('click',(e)=>{
pastaNoodle.forEach((item) => {
if (item.checked && item.value == "pasta") {
noodle = "파스타";
}
else if (item.checked && item.value == "tofunoodle") {
noodle = "두부면";
}
else if (item.checked && item.value == "tofunoodlew") {
noodle = "넓은 두부면";
}
});
pastaSauce.forEach((item) => {
if (item.checked && item.value == "tomato") {
sauce = "토마토";
}
else if (item.checked && item.value == "cream") {
sauce = "크림";
}
else if (item.checked && item.value == "rose") {
sauce = "로제";
}
else if (item.checked && item.value == "basil") {
바질크림
}
});
pastaTopping.forEach((item) => {
if (item.checked) {
topping.push(item.value)
}
});
pastapick.innerText = `${noodle}에 ${sauce}소스 그리고 토핑은 ${topping} 입니다.`;
pastaReady.appendChild(pastapick);
});
Also see: Tab Triggers