dongyan6910 2014-04-22 17:31
浏览 58
已采纳

PHP表单CSS和定位

Thank you for taking the time to read/answer this.

First thing: my career page has a pre-made contact form that i turned into a job application. I have two layout questions:

1.) How do i get the 'checkbox' buttons to line up a little closer to each other. I tried td colspan="2" which is the case later in the form for 2 buttons (submit/reset 1 which i removed), but to no avail, "No" appears well to the right of "Yes." I'd like to have it relatively closer to "Yes."

2.) When you pull the drop down for "Experience" down, it forces the image below the form. Once you select your option, the image goes back to its place. Do i absolutely have to absolute position the graphic? Or can i add an overflow maybe to the dropdown? I can't figure it out.

FancyForm is the form i'm using.

Here is the HTML:

<form id="contact-form" name="contact-form" method="post" action="submit.php">
                              <table width="100%" border="0" cellspacing="0" cellpadding="5">
                                <tr>
                                  <td width="15%"><label for="name">Name</label></td>
                                  <td width="70%"><input type="text" class="validate[required,custom[onlyLetter]]" name="name" id="name" value="<?=$_SESSION['post']['name']?>" /></td>
                                  <td width="15%" id="errOffset">&nbsp;</td>
                                </tr>
                                <tr>
                                  <td width="15%"><label for="address">Address</label></td>
                                  <td width="70%"><input type="text" class="validate[required,custom[a-zA-Z\d\s\-\,\#\.\+]+]" name="address" id="address" value="<?=$_SESSION['post']['address']?>" /></td>
                                  <td width="15%" id="errOffset">&nbsp;</td>
                                </tr>
                                <tr>
                                  <td width="15%"><label for="telephone">Telephone</label></td>
                                  <td width="70%"><input type="text" class="validate[required,custom[onlyNumber]]" name="telephone" id="telephone" value="<?=$_SESSION['post']['telephone']?>" /></td>
                                  <td width="15%" id="errOffset">&nbsp;</td>
                                </tr>
                                <tr>
                                  <td width="15%"><label for="email">Email</label></td>
                                  <td width="70%"><input type="text" class="validate[required,custom[email]]" name="email" id="email" value="<?=$_SESSION['post']['email']?>" /></td>
                                  <td width="15%" id="errOffset">&nbsp;</td>
                                </tr>
                                <tr>
                                  <td width="15%"><label for="citizenship">US Citizen</label></td>
                                  <td width="35%"><input type="checkbox" name="citizen" value="yes">Yes</td>
                                  <td width="35%"><input type="checkbox" name="citizen" value="no">No</td>
                                  <td width="15%" id="errOffset">&nbsp;</td>
                                </tr>
                                <tr>
                                  <td width="15%"><label for="age">At Least 18</label></td>
                                  <td width="35%"><input type="checkbox" name="age" value="yes">Yes</td>
                                  <td width="35%"><input type="checkbox" name="age" value="no">No</td>
                                  <td width="15%" id="errOffset">&nbsp;</td>
                                </tr>
                                <tr>
                                  <td width="15%"><label for="previousexp">Have you worked<br> with us before?</label></td>
                                  <td width="35%"><input type="checkbox" name="previousexp" value="yes">Yes
                                  <td width="35%"><input type="checkbox" name="previousexp" value="no">No</td>
                                  <td width="15%" id="errOffset">&nbsp;</td>
                                </tr>
                                <tr>
                                  <td width="15%"><label for="subject">Experience</label></td>
                                  <td width="70%"><select name="subject" id="subject">
                                    <option value="" selected="selected"> - Choose -</option>
                                    <option value="0-5">0-5 Years</option>
                                    <option value="6-10">6-10 Years</option>
                                    <option value="11-15">11-15 Years</option>
                                    <option value="16-20">16-20 Years</option>
                                    </select></td>
                                  <td width="15%" id="errOffset">&nbsp;</td>
                                </tr>
                                <tr>
                              <td><label for="captcha"><?=$_SESSION['n1']?> + <?=$_SESSION['n2']?> =</label></td>
                              <td><input type="text" class="validate[required,custom[onlyNumber]]" name="captcha" id="captcha" /></td>
                              <td valign="top">&nbsp;</td>
                            </tr>
                            <tr>
                              <td valign="top">&nbsp;</td>
                              <td colspan="2"><input type="submit" name="button" id="button" value="Submit" />                              
                              <?=$str?>          <img id="loading" src="img/ajax-load.gif" width="16" height="16" alt="loading" /></td>
                            </tr>
                          </table>
                          </form>

CSS:

#form-container{
    padding:0px;
}

td{
    white-space:nowrap;
}

h1{
    color:#777777;
    font-size:22px;
    font-weight:normal;
    text-transform:uppercase;
    margin-bottom:5px;
}

h2{
    font-weight:normal;
    font-size:10px; 
    text-transform:uppercase;   
    color:#aaaaaa;
    margin-bottom:15px;
    border-bottom:1px solid #484848;
    margin-bottom:15px;
}

label{
    text-transform:uppercase;
    font-size:10px;
    font-family:Tahoma,Arial,Sans-serif;
}

textarea{
    color:#404040;
    font-family:Arial,Helvetica,sans-serif;
    font-size:12px;
}

td > button{
    text-indent:8px;
}

Thank you very much for trying to help <3

  • 写回答

2条回答 默认 最新

  • doujia6503 2014-04-22 17:44
    关注

    Remove overflow:auto from id #wrapper for your image problem

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿