Home>

How to make the styles apply to all blocks, but not simultaneously to all blocks, but only to the one that you hover over

var block= document.querySelector ('. block');
block.onmouseover= function (e) {
  block.style.width= '200px';
};
block.onmouseout= function (e) {
 block.style.width= '100px';
}; 
body {
  background-color: # 202020;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}
.block {
  width: 100px;
  height: 100px;
  background-color: #fff;
  margin-right: 40px;
  transition: .3s;
} 
<
div class= "block" >
<
/div >
<
div class= "block" >
<
/div >
<
div class= "block" >
<
/div >

Please clarify your specific problem or provide more detailed information on what exactly you need. As it stands, it is difficult to understand exactly what you are asking.

Дух сообщества2021-11-19 08:52:47

In my opinion, you have mutually exclusive terms, in the title and text

Дмытрык2021-11-19 08:57:19