【发布时间】:2017-12-21 22:09:30
【问题描述】:
我将 textarea 嵌入到嵌套 svg 中的 foreignObject 中,但 textarea 无法在我最新的 chrome 中显示。有人能帮我吗?提前致谢!
textarea {
resize: none;
width: 128px;
height: 20px;
font-size: 13px;
}
<svg width="1000" height="200">
<foreignObject x="35" y="10" width="130" height="22">
<input type="text" maxlength="20" style="width: 128px;">
</foreignObject>
<svg xmlns="http://www.w3.org/2000/svg" class="node" x="170" y="0">
<foreignObject x="20" y="0" width="143" height="32">
<p>text not show after input charactors below</p>
<textarea contenteditable>112233112233112233112233112233112233</textarea>
<div>123</div>
</foreignObject>
</svg>
【问题讨论】:
-
因为你是外来对象的宽度限制了它 width="143" 并且你必须增加文本区域的高度才能可见。
标签: javascript html css d3.js svg