-1
Guys, I made the following code and I am in doubt with the pseudo-classes, in case I created buttons but the change of the :active effect only happens while I keep cursor pressed, there is some way to keep that change until another button is selected?
Below is the code + css.
.box {
width: 500px;
border: 10px solid whitesmoke;
padding: 25px;
display: block ruby;
}
a.dados {
background: url(https://i.ibb.co/MSCwHBz/do-utilizador.png);
width: 40px;
height: 40px;
background-size: 40px;
display: block;
background-color: #f0eaea;
padding: 5px;
background-repeat: no-repeat;
background-position: center;
border: 2px solid #8080802e;
}
a.bio {
background: url(https://i.ibb.co/Y0BCMpW/livro.png);
width: 40px;
height: 40px;
background-size: 34px;
display: block;
background-color: #f0eaea;
padding: 5px;
background-repeat: no-repeat;
background-position: center;
border: 2px solid #8080802e;
margin: 2.5px;
}
a.rel {
background: url(https://i.ibb.co/LPgTZQJ/protecao.png);
width: 40px;
height: 40px;
background-size: 34px;
display: block;
background-color: #f0eaea;
padding: 5px;
background-repeat: no-repeat;
background-position: center;
border: 2px solid #8080802e;
margin: 2.5px;
}
a.inv {
background: url(https://i.ibb.co/grLSV8N/caixa.png);
width: 40px;
height: 40px;
background-size: 34px;
display: block;
background-color: #f0eaea;
padding: 5px;
background-repeat: no-repeat;
background-position: center;
border: 2px solid #8080802e;
margin: 2.5px;
}
#dados {
background: green;
width: 496px;
height: 200px;
position: absolute;
margin-top: 52px;
margin-left: -7px;
border: 2px solid #dcd7d7;
}
#bio {
background: #bf0606;
width: 496px;
height: 200px;
position: absolute;
margin-top: 55px;
margin-left: -63px;
border: 2px solid #dcd7d7;
display: none;
}
#rel {
background: #0f42dd;
width: 496px;
height: 200px;
position: absolute;
margin-top: 55px;
margin-left: -122px;
border: 2px solid #dcd7d7;
display: none;
}
#inv {
background: #b55029;
width: 496px;
height: 200px;
position: absolute;
margin-top: 55px;
margin-left: -181px;
border: 2px solid #dcd7d7;
display: none;
}
a.dados:active {
background-color: #978f8f;
}
a.bio:active {
background-color: #978f8f;
}
a.rel:active {
background-color: #978f8f;
}
a.inv:active {
background-color: #978f8f;
}
a.inv:active #inv {
display: block; !important
}
<div class="box">
<a class="dados"><div id="dados"></div></a>
<a class="bio"><div id="bio"></div></a>
<a class="rel"><div id="rel"></div></a>
<a class="inv"><div id="inv"></div></a>
<div class="cred"></div>
</div>
What exactly do you want? change the color when you hover over the object? Use :Hover to do this. If you want to click and show another color, use javascript with the html onclick event
– IanMoone
No, the color was just a test, I wanted to make the #div visible while not changing the option.
– Igor Guedes
To make a div visible with CSS use display: block. To hide will be display: None. By intending to do this while not changing option can do through javascript. In the html tag you add onclick="function", and in the javascript you call this function and change the tag display type
– IanMoone