Search code examples
htmlcssstylesheettypography

Clipping text to a DIV in CSS


What's the best way to clip text to a DIV in CSS? For example, to clip the word 'TESTING' to the DIV as shown below. Currently, the text extends past the end of the DIV, despite the DIV height being less than the text height.

Example


Solution

  • With css overflow: hidden.

    JSFiddle Demo