在文本区域/段落文本中减少行数 - Gravity Forms v2.10.3
Need ability to limit the HEIGHT on the textarea (paragraph text) and still allow user ability to vertically resize the box. Even while selecting field size: SMALL, this renders as 10 rows high in the Dom.
DOM显示该字段的高度在rows=10时被硬编码。
Goal: Limit textarea rows to 3 and allow user ability to resize box vertically.
目标:将文本区域的行数限制为3,并允许用户垂直调整文本框的大小。
IMHO: Past GF versions made this easy. I don't understand why this version is so aggressive.
依我之见:过去的GF版本很容易做到这一点。我不明白为什么这个版本会如此强硬。
What I've done:
Tried numerous versions of function hooks from Claude, ChatGPT and Gemini. None seem to be able to target this hardcoded row count.
我所做的工作:尝试了来自Claude、ChatGPT和 Gemini的多种函数钩子版本,但似乎都无法针对这个硬编码的行数进行修正。
Some CSS styling can certainly make the textarea shorter, but restricts the ability for the user to resize vertically. ie: max-height, height, line-height.
当然,某些CSS样式确实可以让文本区域变短,但会限制用户垂直调整大小的能力。即:max-height、height、line-height。
解决方案
Easiest way is probably to override the styles that are actually controlling the height of the element. Here's something you can copy and paste:
最简单的做法大概是覆盖实际控制该元素高度的样式。下面是一段你可以直接复制粘贴的代码:
.gform-theme.gform-theme--foundation .gfield textarea.small {
block-size: 5.6rem;
min-block-size: auto;
}
One useful addition: autogrow! With this, users never have to manual resize the textarea. Big UX win.
一个有用的补充:autogrow!有了它,用户再也不需要手动调整文本区域的大小。这是一个巨大的用户体验提升。