span contenteditable width won't work

眉间皱痕 提交于 2019-12-23 16:59:03

问题


When the span tag is used with the attribute contenteditable="true" then it ignores all width css

    <span contenteditable="true" style="width:400px;border:1px solid black;">
    Content filler
    </span>

The above produces this
   


Does anybody know how to make it so the box doesn't conform to the text like this and follows regular CSS?

回答1:


span is a display:inline element. Width doesn't work on inline elements.

Apply either display:inline-block; or display:block; to the span.



来源:https://stackoverflow.com/questions/18025831/span-contenteditable-width-wont-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!