這裏是一個什麼樣的效果,我想有一個形象:創建內容編輯的DIV在與文本範圍內
ICON LINE - 1 Some text Inside a div element
and the next line should start
here
ICON LINE - 2 Some text Inside a div element
and the next line should start
here
ICON LINE - 3 Some text Inside a div element
and the next line should start
here
這裏是我試過的代碼:
<div>
<div>
<span style="padding-left: 40px;">ICON</span>
<div contenteditable="true" style="display:inline-block; padding-left: 20px; width:200; position: absolute;">
<font> LINE 1 -- Some text Inside a div element and the next line should start here kjdaskjdaskldjaskldjaskldjaskldjaskljdaskljdaslkjdkl</font>
</div>
</div>
<div>
<span style="padding-left: 40px;">ICON</span>
<div contenteditable="true" style="display:inline-block; padding-left: 20px; width:200; position: absolute;">
<font>LINE 2 -- Some text Inside a div element and the next line should start here kjdaskjdaskldjaskldjaskldjaskldjaskljdaskljdaslkjdkl</font>
</div>
</div>
</div>
這裏是一個演示: http://jsfiddle.net/supersuraccoon/djv83qpd/1/
它幾乎在那裏,但你可以在上面的鏈接看到所有的文字重疊。
任何建議將讚賞,感謝:)
您需要滾動或您需要擴展div之間的空間? –
爲什麼你需要絕對定位? –
當前兩個div(包含line1,line2)內的內容重疊。我希望第二個div跟着第一個div(比如他們之間有一個20px)。你可以檢查jsfiddle演示。 – supersuraccoon