HTML
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Manipulando o DOM - Aula 3</title>
<link rel="stylesheet" href="style_desafio.css">
<script defer src="script_desafio.js"></script>
</head>
<body>
<button onclick="mostraTintas(this)">Aluratintas em estoque:</button>
<button data-buttonHide="buttonHide" onclick="Hide()">Desaparecer</button>
<ul class="lista">
<li cor="laranja" tipo="tinta-exterior" class="item">Tinta laranja</li>
<li cor="vermelho" tipo="tinta-interior" class="item">Tinta vermelha</li>
<li cor="branco" tipo="tinta-interior" class="item">Tinta branca</li>
<li cor="amarelo" tipo="tinta-exterior" class="item">Tinta amarela</li>
<li cor="rosa" tipo="tinta-exterior" class="item">Tinta rosa</li>
<li cor="preto" tipo="tinta-exterior" class="item">Tinta preta</li>
</ul>
<a href="https://alura.com.br/" target="_blank"><img src="https://www.alura.com.br/assets/img/home/alura-logo.svg" alt="" class="alura-logo"></a>
</body>
</html>
CSS
* {
margin: 0;
padding: 0;
}
body {
font-family: "Roboto Mono", monospace;
min-height: 400px;
min-width: 450px;
background-size: 80vh;
color: rgb(0, 0, 0);
background-image: url("https://www.uniabeu.edu.br/wp-content/uploads/2020/03/fundo-lilas.png");
background-size: cover;
background-repeat: no-repeat;
height: 100vh;
font-size: 24px;
font-weight: bold;
display: flex;
align-items: center;
flex-direction: column;
}
button {
font-size: 24px;
font-family: "Futura Lt BT", sans-serif;
background-color: black;
background-repeat: no-repeat;
cursor: pointer;
overflow: hidden;
outline: none;
padding: 8px 20px 8px 20px;
color: white;
box-shadow: 0px 0px 5px gray;
border-radius: 5px 5px 0 0;
border: none;
transition: 500ms;
opacity: 0.8;
margin: 30px 0;
}
button:hover {
color: white;
background-color: gray;
}
button:active {
color: black;
background-color: white;
}
.lista {
padding: 20px;
list-style-type: none;
border: 4mm ridge rgba(234, 122, 11, 0.992);
}
.alura-logo {
width: 150px;
position: absolute;
top: 2%;
right: 2%;
z-index: -1;
}
[cor="laranja"] {
color: orange;
}
[cor="vermelho"] {
color: red;
}
[cor="branco"] {
color: white;
}
[cor="amarelo"] {
color: yellow;
}
[cor="rosa"] {
color: pink;
}
[cor="preto"] {
color: black;
}
[data-buttonHide=buttonHide] {
display: none;
}
JS
const listDown = document.querySelector('ul')
const buttonHide = document.querySelector('[data-buttonHide]')
const button = document.querySelector('button')
function mostraTintas(){
button.style.display ='none'
buttonHide.style.display = 'block'
listDown.style.display = 'none'
}
function Hide() {
button.style.display = 'block'
buttonHide.style.display = 'none'
listDown.style.display = 'block'
}