我正在尝试修复文本区域开头的文本,我现在拥有的是:
<div>
<textarea class="title-text" placeholder="do something..." rows="2" maxlength="80"></textarea>
<span class="before-title">I will,</span>
</div>
此链接中的详细信息:http://jsbin.com/tolifa/1/watch?html,css,输出
but the real issue is when the user types text bigger than the textarea size ( the size of textarea should be unchanged), the fixed text is not moved to top and this issue appears :
我需要一些 JS 来更新到 csstop
类的财产before-title
当文本区域内容改变时
没有 javascript 的解决方案是:
http://jsfiddle.net/vsync/qu0q8qgc/
<div class='tArea' contenteditable data-fixedtitle='fixed title: '>This is the default text</div>
CSS
.tArea{ font:20px/1.2 arial; border:1px solid #CCC; padding:1em; margin:1em; height:5em; overflow:auto;
&::before{ content:attr(data-fixedtitle); color:red; }
> span{ float:left; color:red; }
> p{ margin:0; padding:0; }
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)