Check if an element’s content is overflowing?

What’s the easiest way to detect if an element has been overflowed?

My use case is, I want to limit a certain content box to have a height of 300px. If the inner content is taller than that, I cut it off with an overflow. But if it is overflowed I want to show a ‘more’ button, but if not I don’t want to show that button.

Is there an easy way to detect overflow, or is there a better method?

15 Answers
15

Leave a Comment