Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

span contenteditable width won't work

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?

like image 908
Jayden Michael Ireland Avatar asked Jun 05 '26 12:06

Jayden Michael Ireland


1 Answers

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

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

like image 136
user1721135 Avatar answered Jun 08 '26 01:06

user1721135