javascript - 调整 textarea 和 div 的大小——但调整到与 div 调整大小相同的比例

标签 javascript jquery html css textarea

$( "#panel" ).resizable({
        animate: true,
        ghost: true
    });

你好,我有这个 javascript 代码(上面)和这个 html 代码(下面):

<div id=panel><br><form action="postit.php" method="post" name="post" style = "margin-left:40px;">
<textarea required cols="35" rows="5" name="status" style = "max-width: 500px; max-height: 150px;  width: 95%; opacity: 1;" class="resizable" id = "statuses">
</textarea>
<br>
<input type="submit" name="submit" value="Post Status!"/>
</form></div>

那么我必须输入什么代码才能使它也将 textarea 调整为与 div 调整大小相同的比例?

最佳答案

百分比。

<textarea id="textarea" style="width:50%; height:50%;">

Watch in Jsfiddle

关于javascript - 调整 textarea 和 div 的大小——但调整到与 div 调整大小相同的比例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8022420/

相关文章:

javascript - 哪个更快?值计算或公式 - Google Sheets 脚本编辑器 :

javascript - 如何从查看源代码中隐藏我的 js 文件和 js 库

javascript - 如何保存引用 User 对象的 Parse 对象?

jquery - $(document).ready() 图像超时

html - 我似乎无法显示背景图像。背景图像出现一瞬间但随后崩溃 'failed to execute CreateElement'

javascript - 打开时使整个页面变暗并在关闭对话窗口时产生淡出效果

javascript - 在 body 上使用 addEventListener 绑定(bind)滚动事件不起作用。为什么?

javascript - 将 CSS 类添加到 YADCF Select2 容器

html - CSS 以防止星级评定重置为多个星级

html - 为什么我的网页上有多余的空间?