我想在我的网页上添加一个文本框,但它必须放在 div 标签内以保持布局。我不希望用户能够调整文本框的大小,直到它超出我放置它的 div 标记,因为这会破坏整个布局。有没有一种方法可以设置文本框的最大尺寸?
谢谢帮助!
谢谢帮助!
CSS:
textarea {
width:400px;
height:200px;
resize:none; /* disable resize functionality */
}
最简单的方法(虽然有点粗糙)是在行内样式中设置文本区域。如果您定义了宽度并将resize:none,您的用户将无法调整文本区域的大小并破坏您的设计。
<div>
<textarea name="yourtextarea" style="width:300px;height:200px;resize:none;" /></textarea>
</div>
<head> // place in your header
<style type="text/css">
#textAreaId {
width:300px;
height:200px;
resize:none;
}
</style>
</head>
<body> // place inside of your div, within the body tag
<div>
<textarea id="textAreaId" name="yourtextarea" /></textarea>
</div>
<body>
height
声明,并在 HTML 中将其内联添加。为什么不直接给我点赞呢?! - Alexdiv
标签在哪里? - Alex