css - 输入标签尺寸较大且输入标签中的文本垂直居中

标签 css input textinput

这是我需要做的表格:

enter image description here

现在我处于这一点:

enter image description here

正如您所观察到的,我需要将输入按钮创建得更大。否则视觉上它不会起作用。我的问题是如何创建更大的垂直输入按钮,并且输入文本保持在框中间垂直居中。

CSS 解决方案将是最好的。

这是我的 html 代码(如果有帮助的话):

<form name="bookingform" action="form-to-email.php" method="post">
                            <div id="form_box" class="gradient">
                                <div id="center_box">
                                    <h3>WANT TO BOOK ME?</h3>
                                    <div id="form_data">
                                        <br>
                                        <table>
                                            <tr>
                                                <td><input type="text" value="Company name" name="company" /></td>
                                                <td class="tdright"><input type="text" value="Name" name="name" /></td>
                                            </tr>
                                            <tr>
                                                <td><input type="text" value="Telephone" name="telephone" /></td>
                                                <td class="tdright"><input type="text" value="Email" name="email" /></td>
                                            </tr>
                                            <tr>
                                                <td><input type="text" value="Booking date" name="date" /></td>
                                                <td><input type="button" /></td>
                                            </tr>
                                        </table>
                                    </div>  
                                    <div id="form_text">
                                        <br>
                                        <textarea rows="10" cols="40" name="message">Your text...</textarea>
                                        <input type="submit" value="SEND" name="submit" />
                                    </div>
                                    <input type="image" src="" name="Send" />
                                </div>
                            </div>
                        </form>

最佳答案

input[type=button] {
    height: 35px;      /* increase the height */
    line-height: 35px; /* vertically align the text */
}

DEMO

关于css - 输入标签尺寸较大且输入标签中的文本垂直居中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12184243/

相关文章:

javascript - jQuery Append 删除/隐藏以前的对象

css - 如何显示隐藏的对象

react-native textinput securetextentry 星而不是点

html - 如何将 div 样式设置为像火箭一样?

html - 如何将 SVG 转换(旋转)属性更改为 CSS?

angular - 何时使用@ViewChild、@Input 和@Output?

javascript - 将 HTML 用户输入保存到 Javascript 变量

java - 需要扫描仪输入阵列

javascript - 单击时清除文本

ios - TextInpout 自动更正在 ios 中显示相反 [react native]