Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 42 additions & 3 deletions capítulos/formulários/input_range.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,61 @@
<head>
<meta charset="UTF-8">
<title>input range</title>
<link rel="stylesheet" type="text/css" href="main.css">
<style type="text/css">
#texto{
border: solid 3px black;
background-color: black;
}
</style>
</head>
<div class="center white-background">
<body>
<h1>input range</h1>
<h2>Para que serve o input range? 🤔</h2>
<p>Ele define um valor dentro de um intervalo que geralmente não é importante, pois é mais utilizado para fazer
controles deslizantes.</p>
<p>O valor padrão do intervalo vai de 0 a 100.</p>
<p>Veja um exemplo a seguir: </p>
<p>Veja um exemplo a seguir: (Mexa para revelar um texto bem colorido) </p>
<form>
<label for="vol">Controle (entre 0 e 5):</label>
<input type="range" id="vol" name="vol" min="0" max="5">
<label for="vol">Controle (entre 1 e 6):</label>
<input type="range" id="cor" name="vol" min="1" max="6" value="1" onchange="troca_cor()">
</form>
<p id="texto">Esse texto BONITO troca de cor ao mexer na barrinha aqui de cima :3</p>
<p>Existem duas tags que se colocam dentro do input para definir o intervalo dos números no controle: </p>
<ul>
<li><b>min=" "</b> - Para o menor número</li>
<li><b>max=" "</b> - Para o maior número</li>
</ul>
</div>
</body>
<script type="text/javascript">
function troca_cor(){
let valor = document.getElementById("cor").value;
if(valor === '1'){
document.getElementById("texto").style.color = "red";
}
if(valor === '2'){
document.getElementById("texto").style.color = "orange";
}
if(valor === '3'){
document.getElementById("texto").style.color = "yellow";
}

if(valor === '4'){
document.getElementById("texto").style.color = "green";
}
if(valor === '5'){
document.getElementById("texto").style.color = "blue";
}
if(valor === '6'){
document.getElementById("texto").style.color = "purple";
}





}
</script>
</html>
6 changes: 4 additions & 2 deletions capítulos/formulários/main.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

/* se aplica a todos os elementos que não foram especificados abaixo */
.center {
margin: auto;
Expand All @@ -22,13 +23,14 @@ img.center {
}

body {
background-color: #FFFFFF;
background-color: rgb(133, 97, 254);
margin-top: 0;
margin-bottom: 0;
font-family:Arial;
}

.white-background {
background-color: white;
background-color: rgb(255, 255, 255);
height: 100vh;
padding-left: 30px;
padding-right: 30px;
Expand Down