html - 在 textarea 上定位文本

标签 html css

我想在我的文本区域的右上角添加一个 div/文本。

HTML

<div id="textarea-container">
    <textarea></textarea>
    <div id="copy">copy</div>
</div>

CSS

div#textarea-container {
    position: absolute;
}

div#copy {
    position: relative;
    right: 0;
}

需要做哪些调整?

jsFiddle: http://jsfiddle.net/zrpgK/

最佳答案

工作 jsfiddle 代码 jsfiddle

div#textarea-container {
   position: relative;
   float: left;
}
div#copy {
   position: absolute;
   right: 5px;
   top: 0;
}

关于html - 在 textarea 上定位文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15577166/

相关文章:

html - 如何在 Hugo 模板中将值列表转换为逗号分隔的字符串

javascript - jQuery 在悬停状态下不触发事件

javascript - 如何默认隐藏jQmobile页面

javascript - 使用动态 ID 获取单击的 div 的属性

html - 为什么我的固定布局表格不如其列宽?

html - 如何修复 : "Social Media Sprites not Displaying Correctly in Portrait Mode"

html - HTML 元素溢出中的图像

javascript - 当 div 高度改变时发出警报

java - 用于文本填充的带有 HTML CSS 的 GWT 标签

html - Bootstrap CSS : body not containing all elements on page