在简单HTML表单上的输入字段之间分配填充

时间:2016-07-19 18:44:23

标签: css forms padding html-form spacing

我有一个简单的HTML表单连接到我的CSS页面,我希望该表单在其他显示器上显得美观。但是,我无法弄清楚按钮和输入框的方式是在与屏幕相比的形式的某个位置(即从底部提交按钮5%,每个输入字段填充之间有5%填充,输入无论显示器大小如何,字段都会填充屏幕上的表单。我已成功设置实际表单的最大宽度和高度,但无法弄清楚如何处理内部的内容。

总而言之,当我在其他显示器上调出我的网站时,文本字段看起来太小,并且提交按钮下方有很大的空白区域。我想看看是否有办法让所有东西尽可能均匀地间隔开。



/* Form CSS */

.form-style-5{
    position: relative;
    top: 0px;
    max-width: 60%;
    height: 83%;
    padding: 10px 20px;
    background: #f4f7f8;
    margin: 10px auto;
    border-radius: 8px;
    font-family: "Avant Garde", Avantgarde, "Century Gothic", CenturyGothic, AppleGothic, sans-serif;
}
.form-style-5:after{
    opacity: 1;
}
.form-style-5 fieldset{
    border: none;
}
.form-style-5 legend {
    font-size: 1.4em;
    margin-bottom: 10px;
}
.form-style-5 label {
    font-size: 1.3em;
    display: block;
    margin-bottom: 8px;
}
.form-style-5 input[type="text"],
.form-style-5 input[type="date"],
.form-style-5 input[type="datetime"],
.form-style-5 input[type="email"],
.form-style-5 input[type="location"],
.form-style-5 input[type="number"],
.form-style-5 input[type="search"],
.form-style-5 input[type="time"],
.form-style-5 input[type="url"],
.form-style-5 textarea,
.form-style-5 select {
    font-family: Georgia, "Times New Roman", Times, serif;
    background: rgba(255,255,255,.1);
    border: none;
    border-radius: 4px;
    font-size: 16px;
    margin: 0;
    outline: 0;
    padding: 7px;
    height: 6%;
    width: 100%;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box; 
    background-color: #e8eeef;
    color:#8a97a0;
    -webkit-box-shadow: 0 1px 0 rgba(0,0,0,0.03) inset;
    box-shadow: 0 1px 0 rgba(0,0,0,0.03) inset;
    margin-bottom: 20px;
    
}
.form-style-5 input[type="text"]:focus,
.form-style-5 input[type="date"]:focus,
.form-style-5 input[type="datetime"]:focus,
.form-style-5 input[type="email"]:focus,
.form-style-5 input[type="number"]:focus,
.form-style-5 input[type="search"]:focus,
.form-style-5 input[type="time"]:focus,
.form-style-5 input[type="location"]:focus,
.form-style-5 textarea:focus,
.form-style-5 select:focus{
    background: #d2d9dd;
}
.form-style-5 select{
    -webkit-appearance: menulist-button;
    height:35px;
}
.form-style-5 .number {
    background: red;
    color: #FCFBE3;
    height: 25px;
    width: 25px;
    display: inline-block;
    font-size: 0.8em;
    margin-right: 4px;
    line-height: 25px;
    text-align: center;
    text-shadow: 0 1px 0 rgba(255,255,255,0.2);
    border-radius: 0px 15px 15px 15px;
}

.form-style-5 input[type="submit"],
.form-style-5 input[type="button"]{
    position: relative;
    display: block;
    padding: 10px 39px 10px 39px;
    color: #FCFBE3;
    margin: 0 auto;
    background: red;
    font-size: 18px;
    text-align: center;
    font-style: normal;
    width: 100%;
    border: 1px solid red;
    border-width: 1px 1px 3px;
    margin-bottom: 10px;
}
.form-style-5 input[type="submit"]:hover,
.form-style-5 input[type="button"]:hover{
    background: #b30000;
}

<div class="form-style-5">
    <form action="send-sms.php" method="POST">
        <fieldset>
            <legend><span class="number">1</span> Your Information</legend>
            <input type="text" name="field1" id="name" placeholder="Your Name *">
            <input type="email" name="field2" id="contact"placeholder="Contact Information (Email, Phone Number, etc.) *">
            <input type="location" name="field3" id="location" placeholder="Your Location (i.e. McNutt, Hodge Hall, exact address, etc.)*">
            <input type="text" name="field4" id="misc" placeholder="Miscellaneous Information That May Be Important"></textarea>
            <label for="job">Urgency:</label>
            <select id="job" name="field5">
                <optgroup label="Urgency level: just for us to prioritize properly">
                    <option value="Not Urgent">Low (ETA: Up to an hour)</option>
                    <option value="reading">Normal (ETA: Up to 45 mins)</option>
                    <option value="boxing">Critical (ETA: ASAP!)</option>
                </optgroup>
            </select>
        </fieldset>
        <fieldset>
            <legend><span class="number">2</span>Task that needs completion</legend>
            <input type="text" id="task" name="field6" placeholder="Let Us Know How We Can Help!*"></input>
        </fieldset>
        <input name="submit" type="submit" value="Submit" onClick="push();validateForm();"/>
    </form>
</div>
&#13;
&#13;
&#13;

0 个答案:

没有答案