Given two adjacent <p>
elements, is it possible using a pure CSS solution to display the second <p>
element if text ellipsis is activated on the first one and it's being hovered over?
.container {
width: 200px;
}
.ellipsis {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.ellipsis + p {
display: none;
}
.ellipsis:hover + p {
display: inline-block;
}
<div class="container">
<p class="ellipsis">Long text that might overflow and produce an ellipsis</p>
<p>Text that shows on ellipsis hover</p>
</div>
Here's a JsFiddle of the problem if needed
e.g. If the container
is set to 400px, hovering over the first <p>
element should not display the second <p>
element
element if text ellipsis is activated on the first one and it's being hovered over", "If the container is set to 400px, hovering over the first
element should not display the second
element" two opposite statements.
– André Aug 30 '23 at 11:36` element shouldn't display the second one. But given a container width of 200px, then ellipsis will be activated and it should happen.
– Shane Callanan Aug 30 '23 at 11:38