I have a user interface that looks something like this.
+---------------------------+
| |
| +--area1--+ +--area2--+ |
| | | | | |
| | | | | |
| +---------+ +---------+ |
| |
+---------------------------+
I would like both area1 and area2 to display a specific style when either of them freezes. Right now, if the pointer is over area1, I get
+---------------------------+
| |
| +--area1--+ +--area2--+ |
| |.........| | | |
| |....☝....| | | |
| +---------+ +---------+ |
| |
+---------------------------+
If the pointer is over area2, I get
+---------------------------+
| |
| +--area1--+ +--area2--+ |
| | | |.........| |
| | | |....☝....| |
| +---------+ +---------+ |
| |
+---------------------------+
I want the pointer to be above region 1 or region2. I have both areas display a hang state
+---------------------------+
| |
| +--area1--+ +--area2--+ |
| |.........| |.........| |
| |....☝....| |.........| |
| +---------+ +---------+ |
| |
+---------------------------+
Is this only possible with CSS?
Here are some live HTML / CSS
* {
box-sizing: border-box;
}
html,body {
width: 100%;
height: 100%;
margin: 0;
}
.container {
display: flex;
justify-content: center;
align-content: center;
height: 100%;
}
.unrelatedcontainer {
width: 100%;
height: 100%;
border: 1px solid red;
}
.area1,
.area2 {
margin: 3em;
height: 80%;
border: 1px solid black;
display: flex;
justify-content: center;
align-content: center;
align-items: center;
}
.area1:hover,
.area2:hover {
background-color: green;
}
<div class="container">
<div class="unrelatedcontainer">
<div class="area1">
<div class="content">area1</div>
</div>
</div>
<div class="unrelatedcontainer">
<div class="area2">
<div class="content">area2</div>
</div>
</div>
</div>
Run codeHide result
source
share