Get real width of elements with jQuery

前端 未结 6 1980
Happy的楠姐
Happy的楠姐 2021-02-12 16:48

I am writing a validator for \"visual correctness\" of html files. The goal is to detect too wide elements.

Here is a demo of my problem.

The do

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-12 17:33

    The element itself is constrained to 200px, but the text inside spills out. If you insert a span (or any other inline element) inside the P tag it works fine.

    http://jsfiddle.net/will/vv68y/5/

    Hope that helps :)

提交回复
热议问题