css - 定位所有浏览器的表单输入字段

标签 css forms browser input position

这是我第三次尝试解决这个问题——在 stackoverflow 社区的帮助下,我认为我离解决它更近了。我创建的联系表单上的输入字段在 Chrome 和 Safari 中较低(相对于 FF),在 IE 中较高。我已经实现了这里给出的许多建议,但仍然无法为所有浏览器定位它们。我能够通过使用 normalize.css 取得一些进展

我已经设置了一个测试页面:http://tinyurl.com/d3pxoe2

这是我的联系方式:

 <div id="contactcontainer" class="contactform">


 <form method="post" name="validation" action="index.php" onsubmit="return validateForm();">

 <div class="containerleftside">

 <input type="text" class="shared" name="firstname" autofocus placeholder="Your first name" value="<?php echo $firstname;?>" style="margin-left:142px; margin-top: 108px;"/>
 <input type="text" class="shared" name="lastname" placeholder="Your last name" value="<?php echo $lastname;?>" style="margin-left:140px; margin-top:2px;"/>
 <input type="text" class="shared" name="email" placeholder="Your email name" value="<?php echo $email;?>" style="margin-left:84px; margin-top:1px;" />
 <input type="text" class="shared" name="location" placeholder="Your location" value="<?php echo $location;?>" style="margin-left: 116px; margin-top:0px;"/>

 </div><!--close of container left-->

 <div align="right" class="containerrightside">

 <textarea name="message" placeholder="What say you?"></textarea>
 <img style="margin-top:-10px; float:right; margin-right:3px;" src="CaptchaSecurityImages.php" />

 <p style="float:left; margin-top:-10px; text-align:left; font-family:'form', 'formIE';  font-size:24px; color:#000;">Security Code:</p>
 <input id="security_code" name="security_code" type="text" style="width:125px; float:left; margin-right:80px; height:1.4em; line-height:1.4em; font-size:1.4em; margin-top:-28px;"/>
 <input class="contact" type="submit" name="submitted" value="contactus" />

 </div><!-- end of containerrightside-->
 </div><!-- end of contactcontainer-->
 </form>

这是CSS:

 #contactcontainer {
background-image:url(../images/contactform.png);
background-repeat:no-repeat;
width:618px; 
height:318px; 
    margin:-10px auto;

 }

 .contactform{width:100%; height: 318px; margin:0 auto; padding:0;}
 .contactform input, textarea { background: none; font-size:1.4em; border:none; font-family:'form', 'formIE'; font-color:#999;}
 .contactform .contact{font-size:0px; width:91px; display:block; height:34px; float:right; margin-top:-25px;}
 .contactform .shared{height:1.4em; width: 150px; line-height:1.4em;}

 textarea {
height:120px;
color: #666;
width:260px;
margin-top:20px;

 }

 input:focus, textarea:focus {

 border:1px solid #99cc66;
 }

 .contact:hover {cursor:pointer;}

 .containerleftside {
width: 50%;
float: left;
margin-top:5px; 
text-align:left;
 }

 .containerrightside {
width: 48%;
float: right;
margin-top:110px;   
text-align:left;
height:208px;

 }

最佳答案

可能正在使用 Reset CSS可以帮忙

The goal of a reset stylesheet is to reduce browser inconsistencies in things like default line heights, margins and font sizes of headings, and so on.

关于css - 定位所有浏览器的表单输入字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11805082/

相关文章:

html - 图像最大宽度给出没有滚动高度的滚动条

javascript - 可以在 Javascript 中控制 CSS 溢出滚动条吗?

html - 如何更改 blogspot.com 标题的宽度?

html - "Create or update"按下后退按钮时的表单行为

python - 适用于 Python 的 headless (headless)浏览器,支持多线程、javascript 和 Windows

php - PHP 和 MySQL 的初学者问题

javascript - 动态添加 html 字段,然后将选择的值相乘并相加总计

javascript - 如何防止以html形式模仿RFID读卡器?

browser - Vue-router,如何防止用户在浏览器中按下后退按钮返回登录屏幕?

jquery - 为什么在 Chrome 本地加载页面时会以像素为单位显示小数?