You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求助:WordPress中Contact Form 7文本域与其他字段无法对齐问题

Fixing Contact Form 7 Textarea Alignment Issue

Hey there! I’ve run into this exact alignment problem with Contact Form 7 before—let’s get that textarea lined up perfectly with your name and email fields.

Common Causes & Fixes

1. Box Model Inconsistencies

The most frequent culprit is that your <input> fields and <textarea> are using different box-sizing values. If your theme sets box-sizing: border-box for inputs but not textareas, the textarea will end up wider (since padding and border get added to its base width instead of being included in it).

Add this CSS to your theme’s custom CSS section (Appearance > Customize > Additional CSS):

.wpcf7 input[type="text"],
.wpcf7 input[type="email"],
.wpcf7 textarea {
    box-sizing: border-box;
    width: 100%;
    padding: 8px 12px; /* Match your theme's existing padding values */
    border: 1px solid #ccc; /* Match your theme's border style and color */
}

2. Theme-Specific Style Conflicts

Some themes target textareas with extra padding, margin, or width rules that don’t apply to input fields. To override these inconsistencies, add this additional CSS:

.wpcf7 textarea {
    margin: 0;
    padding: inherit; /* Inherit padding from the input rule above */
    border-width: inherit; /* Ensure border width matches input fields */
}

3. Verify CF7’s Default Styles

Your CF7 code uses [textarea your-message x4]—the x4 only sets the number of visible rows, not the width. But sometimes Contact Form 7 adds default width styles to textareas that inputs don’t get. The CSS above should override this, but if you’re still seeing issues, use your browser’s DevTools (right-click > Inspect Element) to compare the computed styles (width, padding, border) of the textarea with the name/email inputs—you’ll spot the exact difference right away.


内容的提问来源于stack exchange,提问作者cnr_eps

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 07:14:28