Because TextContent has horrible performances on my app in IE and I need to align a div to the right inside another larger div without knowing the width of the text, I am forced to make the div containing the label the same size as the container. How can I make the pointer events apply to the part of the label that contains the text, but not the whole width of the label.
Here's a simple fiddle explaining my problem:
#container {
height: 20px;
width: 350px;
border: 1px solid black;
}
#container:hover {
background-color: green;
}
#label {
height: 20px;
width: 350px;
text-align: right;
}
#label-text:hover {
background-color: red;
}
<div id="container">
<div id="label">
<div id="label-text">shorter hoverable text</div>
</div>
</div>
<div id="result"></div>
In short, how can I make the div turn red only when I hover on the text content itself, but not the left half of the container (which should make it green), even though it hovers the label, but not the text) (the "label" div should have no pointer events unless the text - right half - is the target)width of the text. the "label" div's width cannot be changed as I am not able to use TextContent to get the
EDIT: in the real test case, the container should be move on drag, and the text can be moved along the edge of the container. Because of this issue though, I can drag the label, but I cannot select the contain.er to drag and drop
PS: I have very little leeway as to how the divs are structured.