I have an unordered list in column format that is populated dynamically, usually with just one or two words per <li>
, but occasionally a longer list item appears. In order to preserve my columns, I have chosen to hide the excess text of these longer items with ellipsis:
li {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
But I still want to give the user access to these items, so I've created a hover style like so:
li:hover {
overflow: visible;
}
This reveals the text into the space between columns, but stops when it reaches the neighboring <li>
. I want to give priority to the <li>
that is hovered so it is displayed above the others and with an opaque background. Playing around with z-index
didn't do the trick.
Here is a fiddle: https://jsfiddle.net/9p7qeon2/