你可以通过将.flagColumn的内容包装在一个额外的元素中,将其设置为显示:inline-block;而是设置背景:
.flagColumn {
float: left;
height: 1.6em;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 33%;
z-index: 1;
}
.flagColumn:hover {
overflow: visible;
position: relative;
z-index: 2;
}
.flagColumn:hover span {
background-color: yellow;
display: inline-block;
height: 100%;
}
This is test text!
This is a lot longer test text! This is a lot longer test text!
This is a lot longer test text! This is a lot longer test text!