html - Apply a particular style to an element only if that element is overflowing -
is there way apply particular style element conditionally on overflowing?
e.g. if have say:
<div> text long, no extremely long; goes on , on , on , on. might it's bit duracell(r) bunny, without batteries, , floppy ears. </div>
and
div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } // todo: there way apply rule if text overflowing? div { background-color: red; }
is there way using pure css have background-color: red rule apply if text overflowing?
note: can see way of doing using javascript; want know if there pure css way it.
Comments
Post a Comment