-2

Is there function like hover or something, which checks ifs special area (div or something) is clicked right now or not ? I have some div's with some text and other data, and if i click 1 of them, i want it to do my special stuff after clicking. For example there are 2 div's, if i click first it has to do something for me. (i have a lot of data in that div, not only textarea, input texts, also buttons etc.)

OR is it possible to check if Iclicked div's area? If yes i want to do transform:scale of its area in css (multiplying size)

Makhele Sabata
  • 582
  • 6
  • 16
Timka
  • 3
  • 2

2 Answers2

1

.a:active{
    color: brown;
    background-color: yellowgreen;
}
<div class="a">
you text
</div>
Kirito
  • 146
  • 2
  • 4
1

How about :focus?

You do have to set the div's tabindex property to let it receive focus, however.

Example:

div {
    height: 100px;
    width: 100px;
    border: 1px solid;
    display: inline-block;
    tabindex: 0;
}
div:focus {
  transform: scale(1.5, 1.5);;
}
<div tabindex="0"></div>
<div tabindex="0"></div>
<div tabindex="0"></div>
Bart Hofland
  • 3,700
  • 1
  • 13
  • 22