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.
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div id="selecter" class="select-box01">
<p><select id="Kyouka" onchange="sel1(this);"></select></p>
<p><select id="Bunya" onchange="sel2(this);"></select></p>
<p><select id="Tangen" onchange="sel3(this);"></select></p>
</div>
<div id="MainWindow"style="display:none">
<div class="kokuban-s2">
<p id="q_title"> 問題のタイトル</p>
<p id="text_question" > 問題文</p>
</div>
<a href="#" onclick="Back();">もどる</a><br />
</div>
</div>
</body>
</html>
@charset 'utf-8'; /*文字コード指定*/
/*黒板風ウィンドウ*/
.kokuban-s2 {
position: relative;
margin-left: 15px ;
margin-right: 15px ;
padding: 0.5em;
width: 90%; /* ボックス幅 */
background: #006633; /* ボックス背景色 */
color: #fff; /* 文章色 */
border: 4px solid #b2771f; /* 枠線 */
border-radius: 3px; /* 角の丸み */
box-shadow: 0 0 5px #333, 0 0 5px #555 inset;
}
.kokuban-s2::before,
.kokuban-s2::after {
position: absolute;
content: '';
bottom: 0;
}
.kokuban-s2::before {
width: 20px;
right: 10px;
border: solid 3px #ffff00; /*チョーク(黄色)*/
border-radius: 3px 2px 0 2px;
}
.kokuban-s2::after {
width: 15px;
right: 45px;
border: solid 3px #fff; /*チョーク(白) */
border-radius: 8px 5px 2px 5px;
}
.kokuban-s2 p {
font-size: 1em; /*フォントサイズ指定(emはフォントの高さを1とした相対指定)*/
margin-left: 2px; /*ボックス外側左の余白*/
}
/*問題表示*/
#q_title {
font-size:1.2em;
color:#ffff00;
}
#text_question {
font-size:1.5em;
}
/*解答入力*/
.text-input {
position: relative;
margin-top: 60px;
display: inline-block;
}
.text-input input[type="text"] {
display: inline-block;
width: 360px;
font-size:1.5em;
height: 60px;
box-sizing: border-box;
outline: none;
border: 1px solid lightgray;
border-radius: 3px;
padding: 10px 10px 10px 100px;
transition: all 0.1s ease-out;
}
.text-input input[type="text"] + label {
position: absolute;
font-size:1.5em;
top: 0;
left: 0;
bottom: 0;
height: 60px;
line-height: 60px;
color: white;
border-radius: 3px 0 0 3px;
padding: 0 20px;
background: #E03616;
-webkit-transform: translateZ(0) translateX(0);
transform: translateZ(0) translateX(0);
transition: all 0.3s ease-in;
transition-delay: 0.2s;
}
.text-input input[type="text"]:focus + label {
-webkit-transform: translateY(-110%) translateX(0%);
transform: translateY(-110%) translateX(0%);
border-radius: 3px;
transition: all 0.1s ease-out;
}
.text-input input[type="text"]:focus {
padding: 10px;
transition: all 0.3s ease-out;
transition-delay: 0.2s;
}
/*セレクタ-*/
.select-box01 select {
width: 100%;
padding: 10px;
margin: 10px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
border: 1px solid #999;
background: #eee;
background-size: 20px, 100%;
font-size:1em;
width: 50%;
min-width:240px
}
//教科の選択肢
var KyoukaArray = [
{cd:"", label:"▼教科の選択"},
{cd:"1", label:"算数"},
{cd:"2", label:"理科"},
{cd:"3", label:"社会"},
{cd:"4", label:"国語"},
];
var SansuArray = [//単元の選択肢
{cd:"", label:"▼単元の選択"},
{cd:"1", label:"和と差の文章題"},
{cd:"2", label:"整数と規則性の文章題"},
{cd:"3", label:"割合と比の文章題"},
{cd:"4", label:"速さの文章題"},
{cd:"5", label:"平面図形の計量"},
{cd:"6", label:"相似・線分比と面積比"},
{cd:"7", label:"立体図形の計量"},
{cd:"8", label:"計算問題"},
];
var RikaArray = [//分野の選択肢
{cd:"", label:"▼分野の選択"},
{cd:"11", label:"物理"},
{cd:"12", label:"化学"},
{cd:"13", label:"地学"},
{cd:"14", label:"生物"},
];
var ShakaiArray = [//分野の選択肢
{cd:"", label:"▼分野の選択"},
{cd:"21", label:"地理"},
{cd:"22", label:"歴史"},
{cd:"23", label:"公民"},
];
var KokugoArray = [//分野の選択肢
{cd:"", label:"▼分野の選択"},
{cd:"31", label:"ないよ!"},
];
var WasaArray = [//単元の選択肢
{cd:"", label:"▼単元の選択"},
{cd:"1", label:"和差算"},
{cd:"2", label:"分配算"},
{cd:"3", label:"つるかめ算"},
{cd:"4", label:"差集め算・過不足算"},
{cd:"5", label:"平均算"},
{cd:"6", label:"集合算"}
];
var ButuriArray = [//単元の選択肢
{cd:"", label:"▼単元の選択"},
{cd:"1", label:"ばね"},
{cd:"2", label:"てこ・てんびん"},
{cd:"3", label:"ものの運動"},
{cd:"4", label:"滑車と輪軸"},
{cd:"5", label:"圧力と浮力"},
];
var KagakuArray = [//単元の選択肢
{cd:"", label:"▼単元の選択"},
{cd:"1", label:"空気と水の温度による変化"},
{cd:"2", label:"もののあたたまりかた"},
{cd:"3", label:"気体の性質"},
{cd:"4", label:"水溶液の濃さ"},
{cd:"5", label:"物の燃焼"},
{cd:"6", label:"水溶液の性質(1)"},
];
//教科ボックスの生成
window.onload=function(){
for(var i=0;i<KyoukaArray.length;i++){
let op = document.createElement("option");
op.value =KyoukaArray[i].cd;
op.text = KyoukaArray[i].label;
document.getElementById("Kyouka").appendChild(op);
}
};
//教科が選択された時に呼び出される処理
function sel1(obj){
var targetArr2;
switch(obj.value){
case '1':targetArr2 = SansuArray;break;
case '2':targetArr2 = RikaArray;break;
case '3':targetArr2 = ShakaiArray;break;
case '4':targetArr2 = KokugoArray;break;
default:targetArr2 = new Array();break;
}
var selObj2 = document.getElementById('Bunya');
while(selObj2.lastChild){
selObj2.removeChild(selObj2.lastChild);
}
for(var i=0;i<targetArr2.length;i++){
let op = document.createElement("option");
op.value = targetArr2[i].cd;
op.text = targetArr2[i].label;
selObj2.appendChild(op);
}
}
//分野が選択された時に呼び出される処理
function sel2(obj){
var targetArr3;
switch(obj.value){
case '1':targetArr3 =WasaArray;break;
case '11':targetArr3 =ButuriArray;break;
case '12':targetArr3 =KagakuArray;break;
default:targetArr3 = new Array();;break;
}
var selObj3 = document.getElementById('Tangen');
while(selObj3.lastChild){
selObj3.removeChild(selObj3.lastChild);
}
for(var i=0;i<targetArr3.length;i++){
let op = document.createElement("option");
op.value = targetArr3[i].cd;
op.text = targetArr3[i].label;
selObj3.appendChild(op);
}
}
//単元が選択された時に呼び出される処理
function sel3(obj){
var id1 = document.getElementById('Kyouka');
var id2 = document.getElementById('Bunya');
var id3 = document.getElementById('Tangen');
QID = id1.value+id2.value%10+id3.value;
document.getElementById("selecter").style.display="none";
document.getElementById("text_question").innerHTML="今回の問題番号は"+QID;
document.getElementById("MainWindow").style.display="inline";
}
function Back(){
document.getElementById("selecter").style.display="inline";
document.getElementById("MainWindow").style.display="none";
}
Also see: Tab Triggers