-1
I made a button using ID’s and still when clicked it gives a margin-top=10px
in both. What is my mistake? I want it to take effect only on the button that was clicked!
button{
border: none;
background-color: lemonchiffon;
border-radius: 50%;
padding: 10px;
margin-right: 10px;
box-shadow: 0px 8px #666;
cursor: pointer;
}
#azul:active{
background-color: skyblue;
cursor: pointer;
box-shadow: 0px 5px dimgray;
margin-top: 10px;
}
#red:active{
background-color: tomato;
cursor: pointer;
box-shadow: 0px 5px dimgray;
margin-top: 10px;
}
<div class="bot">
<h2>Avalie nosso site</h2>
<button onclick="positivo()" id="azul">
<span class="fa fa-thumbs-o-up fa-3x" style="color: navy;"></span>
</button>
<button onclick="negativo()" id="red">
<span class="fa fa-thumbs-o-down fa-3x" style="color: red;"></span>
</button>
Javascript missing in question.
– Sergio
That one
margin-top=20px
must be somewhere else, because in those selectors you put in the question no puts 20px.– Roberto de Campos
It is not necessary to use Javascript to resolve this as far as I know
– nelson450
no, I just misspelled at the time
– nelson450
If you call a javascript function in onclick. How is it not necessary? it is possible that you have changed the id of the element where you call the button click event check in your jascript if you have not changed the ids.
– Rafael Salomão
The problem is in CSS. The margin of
button:active
is directly affecting others.– Vitor Adriano
I still haven’t made the Js of the site, I put onclick there to remind me later(I took it and still didn’t help)
– nelson450
How do I make them not to be affected? 'margin-right' higher on the button?
– nelson450