简体   繁体   English

表格的奇怪对齐问题

[英]Strange alignment issue with form

I have a contact form at the bottom of my web page. 我在网页底部有一个联系表。

Whenever I click on any of the fields of the forms, the alignment goes all crazy. 每当我单击表单的任何字段时,对齐都会发疯。 It doesn't happen on my phone, it doesn't happen when I run the site locally (ie on my PC directly from the source code on my hard drive. Offline). 它不会在我的手机上发生,当我在本地运行该站点时也不会发生(即,直接从硬盘驱动器上的源代码在PC上,离线)。

Link to my web page: thisisit.coolpage.biz 链接到我的网页: thisisit.coolpage.biz

CSS used for center alignment(found on an online tutorial): 用于中心对齐的CSS(可在在线教程中找到):

form {
    margin:0 auto;
    width:459px;
    font-family: 'Bree Serif', serif;
}

textarea {
    width:439px;
    height:27px;
    background:#efefef;
    border:1px solid #dedede;
    padding:10px;
    margin-top:3px;
    font-size:0.9em;
    color:#3a3a3a;
    -moz-border-radius:5px;
    -webkit-border-radius:5px;
    border-radius:5px;
}

PS- Ignore the content on the page please :P PS-请忽略页面上的内容:P

Multiple id with the same name on one HTML page can cause problems. 在一个HTML页面上具有相同名称的多个id可能会导致问题。

Change your rule in your css to a class: 将CSS中的规则更改为类:

change: 更改:

#p1{
text-align: center;
font-family: 'Bree Serif', serif;
}

to: 至:

.p1{
text-align: center;
font-family: 'Bree Serif', serif;
}

then on your PAGE change <p id="p1"> to <p class="p1"> . 然后在您的PAGE上将<p id="p1">更改为<p class="p1"> I would try to stay away from multiple IDs on elements like <h1> and <p> . 我会尽量避免在<h1><p>类的元素上使用多个ID。 Otherwise your centering looks okay to me. 否则,您的居中位置对我来说还可以。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM