5
Edited -- Despite having asked exclusively in css, I saw that in fact the final result in JS is much more professional and lean. Being so I confirmed the reply of @Renan as the one that actually helped. Yet I remark here that @Fetz’s response was really the best output for using CSS in this case. However the end effect is ugly, moving the whole page of place.
My doubt is simple. I have used much the :hover
in CSS and has served me to some extent.
However I’ve been wanting something different. I wish I could click on one div
so that it would grow in size, and I would have to click on it in a specific corner so that it would shrink.
The hover
is part of the process, but when I take the mouse off the div
it returns to previous size.
What I want is for div
only change when I click on it. And if possible it only returns to its original form if I click on one X
for example or outside the div
in question.
I’ve searched a lot, I found some things in JS, but I’m doing my best not to use JS in this project. So I started to imagine that with PHP this is possible. Or some CSS keyword to put in stylesheet
in place of hover
.
Do you have any word reserved for this as for example a possible onmouseclick
of life???
Grateful in advance.
#atredit{
position:absolute;
width: 150px;
height: 75px;
background-color: #F5F5F5;
border: 1px solid #111111;
border-radius: 5px;
margin-top: 150px;
margin-left: 200px;
overflow: hidden;
cursor:pointer;
}
#atredit:hover{
width: 150px;
height: 300px;
transition: 0.5s ease-in-out;
}
Hanzer, even though it seems irrelevant in this case, consider that including a code snippet (just the snippet that when you take your mouse off the div it goes back to its original form) will greatly increase your chances of receiving answers.
– gustavox
thanks @gustavox
– Djpessoa
I edited my previous comment to include the excerpt that I think important you include.
– gustavox
Has like, using javascript.
– KaduAmaral
PHP cannot change div sizes because it cannot modify its settings. But Jquery can perfectly solve your problem.
– Samuel Carvalho
Ask me a question @Samuelneiva Is Jquery related to JS? It would be more interesting to use Jquery or JS?
– Djpessoa
Jquery is done in javascript, only more polished. Better to use jquery because it has classes ready to do what you want.
– Samuel Carvalho