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.
<!-- multistep form -->
<form id="msform">
<!-- progressbar -->
<ul id="progressbar">
<li class="active">Conta</li>
<li>Escola</li>
<li>Pessoal</li>
<li>Finalização</li>
</ul>
<!-- fieldsets -->
<fieldset>
<h2 class="fs-title">Regista-te</h2>
<input id="email" type="text" name="email" placeholder="Email" />
<input id = "pass" type="password" name="pass" placeholder="Password" />
<input id = "pass-check" type="password" name="cpass" placeholder="Confirmar Password" />
<select name="tiporegisto">
<option value="0" disabled selected>Tipo de Registo</option>
<option value="aluno">Aluno</option>
<option value="prof">Professor</option>
<option value="pais">Pais</option>
</select>
<input type="button" name="Next" class="next action-button" value="Próximo" />
</fieldset>
<fieldset>
<h2 class="fs-title">Escola..afff</h2>
<select name="escola">
<option disabled selected value = "0">Seleciona a escola</option>
<option value="centroestudosfatima">Centro de Estudos de Fátima</option>
</select>
<select name ="ano">
<option disabled selected value ="0">Ano de escolaridade</option>
<option value="5">5º</option>
<option value="6">6º</option>
<option value="7">7º</option>
<option value="8">8º</option>
<option value="9">9º</option>
<option value="10">10º</option>
<option value="11">11º</option>
<option value="12">12º</option>
</select>
<select id = "metade" name ="turma">
<option disabled selected value ="0">Turma</option>
<option value="a">A</option>
<option value="b">B</option>
<option value="c">C</option>
<option value="d">D</option>
<option value="e">E</option>
<option value="f">F</option>
<option value="g">G</option>
<option value="h">H</option>
<option value="i">I</option>
<option value="j">J</option>
</select>
<select id = "metade" name ="numero">
<option disabled selected value ="0">Número</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
<option value="32">32</option>
<option value="33">33</option>
<option value="34">34</option>
<option value="35">35</option>
</select>
<input type="button" name="previous" class="previous action-button" value="Anterior" />
<input type="button" name="next" class="next action-button" value="Próximo" />
</fieldset>
<fieldset>
<h2 class="fs-title">Já está quase!!</h2>
<input type="text" name="nome" placeholder="Nome" />
<input type="text" name="apelido" placeholder="Apelido" />
<select id = "metade" name ="nascdia">
<option disabled selected value ="0">Dia</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>
<select id = "metade" name ="nascmes">
<option disabled selected value ="0">Mês</option>
<option value="1">Jan</option>
<option value="2">Fev</option>
<option value="3">Mar</option>
<option value="4">Abr</option>
<option value="5">Mai</option>
<option value="6">Jun</option>
<option value="7">Jul</option>
<option value="8">Ago</option>
<option value="9">Set</option>
<option value="10">Out</option>
<option value="11">Nov</option>
<option value="12">Dez</option>
</select>
<select name ="nascano">
<option disabled selected value ="0">Ano</option>
<option value="2002">2002</option>
<option value="2001">2001</option>
<option value="2000">2000</option>
<option value="1999">1999</option>
<option value="1998">1998</option>
<option value="1997">1997</option>
<option value="1996">1996</option>
<option value="1995">1995</option>
<option value="1994">1994</option>
<option value="1993">1993</option>
<option value="1992">1992</option>
<option value="1991">1991</option>
<option value="1990">1990</option>
<option value="9989">1989</option>
<option value="1988">1988</option>
<option value="1987">1987</option>
<option value="1986">1986</option>
<option value="1985">1985</option>
<option value="1984">1984</option>
<option value="1983">1983</option>
<option value="1982">1982</option>
<option value="1981">1981</option>
<option value="1980">1980</option>
<option value="1979">1979</option>
<option value="1978">1978</option>
<option value="1977">1977</option>
<option value="1976">1976</option>
<option value="1975">1975</option>
<option value="1974">1974</option>
<option value="1973">1973</option>
<option value="1972">1972</option>
<option value="1971">1971</option>
<option value="1970">1970</option>
<option value="1969">1969</option>
<option value="1968">1968</option>
<option value="1967">1967</option>
<option value="1966">1966</option>
<option value="1965">1965</option>
<option value="1964">1964</option>
<option value="1963">1963</option>
<option value="1962">1962</option>
<option value="1961">1961</option>
<option value="1960">1960</option>
<option value="1959">1959</option>
<option value="1958">1958</option>
<option value="1957">1957</option>
<option value="1956">1956</option>
<option value="1955">1955</option>
<option value="1954">1954</option>
<option value="1953">1953</option>
<option value="1952">1952</option>
<option value="1951">1951</option>
<option value="1950">1950</option>
<option value="1949">1949</option>
<option value="1948">1948</option>
<option value="1947">1947</option>
<option value="1946">1946</option>
<option value="1945">1945</option>
<option value="1944">1944</option>
<option value="1943">1943</option>
<option value="1942">1942</option>
<option value="1941">1941</option>
<option value="1940">1940</option>
<option value="1939">1939</option>
<option value="1938">1938</option>
<option value="1937">1937</option>
<option value="1936">1936</option>
<option value="1935">1935</option>
<option value="1934">1934</option>
<option value="1933">1933</option>
<option value="1932">1932</option>
<option value="1931">1931</option>
<option value="1930">1930</option>
</select>
<input type="button" name="previous" class="previous action-button" value="Anterior" />
<input type="button" name="Next" class="next action-button" value="Próximo" />
</fieldset>
<fieldset>
<h2 class="fs-title">Resumindo</h2>
<div id="resumo"></div>
<form method="POST" action>
<div id ="captcha">
</div>
<input type="button" name="previous" class="previous action-button" value="Anterior" />
<input type="submit" name="submit" class="submit action-button" value="Registar" /></form>
</fieldset>
</form>
<!-- jQuery -->
<script src="http://thecodeplayer.com/uploads/js/jquery-1.9.1.min.js" type="text/javascript"></script>
<!-- RECAPTCHA -->
<script type="text/javascript" src="https://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script>
<!-- jQuery easing plugin -->
<script src="http://thecodeplayer.com/uploads/js/jquery.easing.min.js" type="text/javascript"></script>
/*custom font*/
@import url(https://fonts.googleapis.com/css?family=Montserrat);
/*basic reset*/
* {margin: 0; padding: 0;}
html {
height: 100%;
/*Image only BG fallback*/
background: url('http://thecodeplayer.com/uploads/media/gs.png');
/*background = gradient + image pattern combo*/
background:
linear-gradient(rgba(196, 102, 0, 0.2), rgba(155, 89, 182, 0.2)),
url('http://thecodeplayer.com/uploads/media/gs.png');
}
body {
font-family: montserrat, arial, verdana;
}
/*form styles*/
#msform {
width: 400px;
margin: 50px auto;
text-align: center;
position: relative;
}
#msform fieldset {
background: white;
border: 0 none;
border-radius: 3px;
box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.4);
padding: 20px 30px;
box-sizing: border-box;
width: 80%;
margin: 0 10%;
/*stacking fieldsets above each other*/
position: absolute;
}
/*Hide all except first fieldset*/
#msform fieldset:not(:first-of-type) {
display: none;
}
#msform input.warning {
border: 1px solid #FF0000;
}
#msform select.warning {
border: 1px solid #FF0000;
}
#msform select#metade.warning {
border: 1px solid #FF0000;
}
/*inputs */
#msform select#metade{
color:#808080;
padding: 15px;
border: 1px solid #ccc;
border-radius: 3px;
margin-bottom: 10px;
width: 49%;
box-sizing: border-box;
font-family: montserrat;
font-size: 13px;
}
#msform select{
color:#808080;
padding: 15px;
border: 1px solid #ccc;
border-radius: 3px;
margin-bottom: 10px;
width: 100%;
box-sizing: border-box;
font-family: montserrat;
font-size: 13px;
}
#msform option:not(:disabled){
color:#2C3E50;
}
#msform input, #msform textarea {
padding: 15px;
border: 1px solid #ccc;
border-radius: 3px;
margin-bottom: 10px;
width: 100%;
box-sizing: border-box;
font-family: montserrat;
color: #2C3E50;
font-size: 13px;
}
/*buttons*/
#msform .action-button {
width: 100px;
background: #27AE60;
font-weight: bold;
color: white;
border: 0 none;
border-radius: 1px;
cursor: pointer;
padding: 10px 5px;
margin: 10px 5px;
}
#msform .action-button:hover, #msform .action-button:focus {
box-shadow: 0 0 0 2px white, 0 0 0 3px #27AE60;
}
/*headings*/
.fs-title {
font-size: 15px;
text-transform: uppercase;
color: #2C3E50;
margin-bottom: 10px;
}
.fs-subtitle {
font-weight: normal;
font-size: 13px;
color: #666;
margin-bottom: 20px;
}
/*progressbar*/
#progressbar {
margin-bottom: 30px;
overflow: hidden;
/*CSS counters to number the steps*/
counter-reset: step;
}
#progressbar li {
list-style-type: none;
color: white;
text-transform: uppercase;
font-size: 9px;
width: 25%;
float: left;
position: relative;
}
#progressbar li:before {
content: counter(step);
counter-increment: step;
width: 20px;
line-height: 20px;
display: block;
font-size: 10px;
color: #333;
background: white;
border-radius: 3px;
margin: 0 auto 5px auto;
}
/*progressbar connectors*/
#progressbar li:after {
content: '';
width: 100%;
height: 2px;
background: white;
position: absolute;
left: -50%;
top: 9px;
z-index: -1; /*put it behind the numbers*/
}
#progressbar li:first-child:after {
/*connector not needed before the first step*/
content: none;
}
/*marking active/completed steps green*/
/*The number of the step and the connector before it = green*/
#progressbar li.active:before, #progressbar li.active:after{
background: #27AE60;
color: white;
}
/*RESUMO*/
#resumo {
padding: 15px;
border: 1px solid #ccc;
border-radius: 3px;
margin-bottom: 10px;
width: 100%;
box-sizing: border-box;
font-family: montserrat;
color: #2C3E50;
font-size: 13px;
}
function showRecaptcha(element) {
Recaptcha.create("6LdvEO8SAAAAACHjXu1Z6D2HIF9OcqMPW2yw8KOf", element, {
theme: "clean",
lang: "pt",
callback: Recaptcha.focus_response_field});
}
//jQuery time
var current_fs, next_fs, previous_fs; //fieldsets
var left, opacity, scale; //fieldset properties which we will animate
var animating; //flag to prevent quick multi-click glitches
var fieldsetn = 1;
var emailantigo;
var passval;
//reposição de texto
//email
$('input[name="email"]').focus(function() {
if ($('input[name="email"]').hasClass('warning') === true && fieldsetn == 1){
$('input[name="email"]').val(emailantigo);
}
});
//algumas partes de css
//select tiporegisto
$("select[name='tiporegisto']").change(function(){
if ($("select[name='tiporegisto']").val() != "0"){
$('select[name="tiporegisto"]').css("color","#2C3E50");
}
});
//click
$(".next").click(function(){
var erros = 0;
//verificação de erros no primeiro fieldset
if (fieldsetn == 1) {
//teste de email
var emailVal=$('input[name="email"]').val();
emailantigo = emailVal.toString();
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
if ($('input[name="email"]').val().length === 0) {
$('input[name="email"]').addClass('warning');
$('input[name="email"]').attr("placeholder","Introduz um email válido");
erros = 1;}
else if(!emailReg.test(emailVal)) {
$('input[name="email"]').attr("placeholder","Introduz um email válido"); $('input[name="email"]').addClass('warning');
$('input[name="email"]').val('');
erros = 1;
}
else {
$('input[name="email"]').removeClass('warning');}//fim do teste
//teste password
passval = $('input[name="pass"]').val();
if ($('input[name="pass"]').val().length < 5) {
$('input[name="pass"]').addClass('warning');
$('input[name="pass"]').attr("placeholder","Password menor que 5 caracteres");
$('input[name="pass"]').val('');
erros = 1;
}
else {$('input[name="pass"]').removeClass('warning');}//fim
//repetir password
var passwordcheckval = $("#pass-check").val();
if (passval != passwordcheckval) {
$('input[name="cpass"]').addClass('warning');
$('input[name="cpass"]').attr("placeholder","Password não corresponde");
$('input[name="pass"]').addClass('warning');
$('input[name="cpass"]').val('');
erros = 1;
}
else if ( passwordcheckval === 0 ){
$('input[name="cpass"]').addClass('warning');
erros =1;
}
else {$('input[name="cpass"]').removeClass('warning');}//fim da pass
//tipo de registo
if ($('select[name="tiporegisto"] option:selected').val() ===0){
$('select[name="tiporegisto"]').addClass('warning');
erros = 1;
}
else {
$('select[name="tiporegisto"]').removeClass('warning');}
//fim
} //fim do primeiro fieldset
else if (fieldsetn == 2){
//ano escolar
if ($('select[name="escola"] option:selected').val() ===0){
$('select[name="escola"]').addClass('warning');
erros = 1;
}
else {
$('select[name="escola"]').removeClass('warning');}
//fim
if ($('select[name="ano"] option:selected').val() ===0){
$('select[name="ano"]').addClass('warning');
erros = 1;
}
else {
$('select[name="ano"]').removeClass('warning');}
//fim
if ($('select[name="turma"] option:selected').val() ===0){
$('select[name="turma"]').addClass('warning');
erros = 1;
}
else {
$('select[name="turma"]').removeClass('warning');}
//fim
if ($('select[name="numero"] option:selected').val() ===0){
$('select[name="numero"]').addClass('warning');
erros = 1;
}
else {
$('select[name="numero"]').removeClass('warning');}
//fim
}//fim do fieldset numero 2
else if ( fieldsetn == 3) {//fieldset numero 3
//verificar nome
if ($('input[name="nome"]').val().length ===0){
$('input[name="nome"]').addClass('warning');
$('input[name="nome"]').attr("placeholder","Preenchimento obrigatório");
erros = 1;
}
else {
$('input[name="nome"]').removeClass('warning');
}
//verificar apelido
if ($('input[name="apelido"]').val().length ===0){
$('input[name="apelido"]').addClass('warning');
$('input[name="apelido"]').attr("placeholder","Preenchimento obrigatório");
erros = 1;
}
else {
$('input[name="apelido"]').removeClass('warning');
}
if ($('select[name="nascdia"] option:selected').val() ===0){
$('select[name="nascdia"]').addClass('warning');
erros = 1;
}
else {
$('select[name="nascdia"]').removeClass('warning');}
//fim
if ($('select[name="nascmes"] option:selected').val() ===0){
$('select[name="nascmes"]').addClass('warning');
erros = 1;
}
else {
$('select[name="nascmes"]').removeClass('warning');}
//fim
if ($('select[name="nascano"] option:selected').val() ===0){
$('select[name="nascano"]').addClass('warning');
erros = 1;
}
else {
$('select[name="nascano"]').removeClass('warning');}
//fim
//Verificar data de nascimento
if ($('select[name="nascmes"]').hasClass('warning') === false && $('select[name="nascdia"]').hasClass('warning') === false && $('select[name="nascdia"]').hasClass('warning') === false) {
var dtMonth = $('select[name="nascmes"]').val();
var dtDay= $('select[name="nascdia"]').val();
var dtYear = $('select[name="nascano"]').val();
if ((dtMonth==4 || dtMonth==6 || dtMonth==9 || dtMonth==11) && dtDay ==31)
{$('select[name="nascmes"]').addClass('warning');
$('select[name="nascano"]').addClass('warning');
erros = 1}
else if (dtMonth == 2){
if ((dtYear%4 !== 0 && dtDay >28) || dtDay>29)
{$('select[name="nascmes"]').addClass('warning');
$('select[name="nascano"]').addClass('warning');
$('select[name="nascdia"]').addClass('warning');
erros = 1}
}
}//fim da verificação de data
}//fim do fieldset numero 3
if (erros === 0){//inicio da animação
if(animating) return false;
animating = true;
fieldsetn = fieldsetn +1;
current_fs = $(this).parent();
next_fs = $(this).parent().next();
if (fieldsetn == 4){
//escrever resumo
var resemail=$('input[name="email"]').val();
var resregisto=$('select[name="tiporegisto"]').val();
var resescola=$('select[name="escola"] option:selected').text();
var resano=$('select[name="ano"]').val();
var resturma=$('select[name="turma"] option:selected').text();
var resnumero=$('select[name="numero"]').val();
var resnome=$('input[name="nome"]').val();
var resapelido=$('input[name="apelido"]').val();
var resnascdia=$('select[name="nascdia"]').val();
var resnascmes=$('select[name="nascmes"]').val();
var resnascano=$('select[name="nascano"]').val();
//cálculo da idade
var dataatual = new Date();//data atual
var anoatual = dataatual.getFullYear();
var mesatual = dataatual.getMonth() + 1;
var diaatual = dataatual.getDate();
//cálculos
var residade;
if ((mesatual>resnascmes) || (mesatual=resnascmes && diaatual>=resnascdia) ){
residade = anoatual - resnascano;}
else if(mesatual=resnascmes && diaatual<resnascdia){
residade = anoatual - resnascano - 1;}
else {
residade = anoatual - resnascano - 1; }
var resumo = "O teu nome é " + resnome+ " " + resapelido+ ", tens "+residade+" anos, és o número "+resnumero+" do "+resano+"º"+resturma+" da escola "+resescola+". <br>O email para o qual enviaremos a confirmação de registo é "+resemail;
$('#resumo').html(resumo);//fim de escrever resumo
showRecaptcha('captcha');//colocar recaptcha
}//fim do fieldset numero 4
//activate next step on progressbar using the index of next_fs
$("#progressbar li").eq($("fieldset").index(next_fs)).addClass("active");
//show the next fieldset
next_fs.show();
//hide the current fieldset with style
current_fs.animate({opacity: 0}, {
step: function(now, mx) {
//as the opacity of current_fs reduces to 0 - stored in "now"
//1. scale current_fs down to 80%
scale = 1 - (1 - now) * 0.2;
//2. bring next_fs from the right(50%)
left = (now * 50)+"%";
//3. increase opacity of next_fs to 1 as it moves in
opacity = 1 - now;
current_fs.css({'transform': 'scale('+scale+')'});
next_fs.css({'left': left, 'opacity': opacity});
},
duration: 800,
complete: function(){
current_fs.hide();
animating = false;
},
//this comes from the custom easing plugin
easing: 'easeInOutBack'
});
}//fim da animação
});//fim do click
$(".previous").click(function(){
if(animating) return false;
animating = true;
fieldsetn = fieldsetn - 1;
current_fs = $(this).parent();
previous_fs = $(this).parent().prev();
//de-activate current step on progressbar
$("#progressbar li").eq($("fieldset").index(current_fs)).removeClass("active");
//show the previous fieldset
previous_fs.show();
//hide the current fieldset with style
current_fs.animate({opacity: 0}, {
step: function(now, mx) {
//as the opacity of current_fs reduces to 0 - stored in "now"
//1. scale previous_fs from 80% to 100%
scale = 0.8 + (1 - now) * 0.2;
//2. take current_fs to the right(50%) - from 0%
left = ((1-now) * 50)+"%";
//3. increase opacity of previous_fs to 1 as it moves in
opacity = 1 - now;
current_fs.css({'left': left});
previous_fs.css({'transform': 'scale('+scale+')', 'opacity': opacity});
},
duration: 800,
complete: function(){
current_fs.hide();
animating = false;
},
//this comes from the custom easing plugin
easing: 'easeInOutBack'
});
});
$(".submit").click(function(){
var captchadesafio = Recaptcha.get_challenge();
var captcharesposta= Recaptcha.get_response();
$.ajax({
type: "POST",
url: '/php/verifycaptcha.php',
data: { 'desafio=': captchadesafio, 'resposta=': captcharesposta }
}).done(function( msg ) {
alert( "Data Saved: " + msg );
});
});
Also see: Tab Triggers