Which elements can be safely made contenteditable?

后端 未结 2 693
礼貌的吻别
礼貌的吻别 2020-12-29 06:07

I\'ve been working with contenteditable recently within a HTML5 page and encountering bugs when using it with certain elements, and I\'d like to know where and how I can act

2条回答
  •  猫巷女王i
    2020-12-29 06:17

    In my opinion, I'd say div is the safest bet across the board. Any element you wish to truly edit (be it a span, header, etc), you can place inside the div and edit as if it were just that element. Also, to account for the display:inline issue you mentioned, you could always use float:left or float:right on your editable div to give it an "inline feel" without having it actually be inline.

    Hope that helps!

提交回复
热议问题