如何使文本框和textarea相同宽度的交叉浏览器? [英] How to make a textbox and a textarea same width cross-browsers?

查看:98
本文介绍了如何使文本框和textarea相同宽度的交叉浏览器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将文本框(即input type =text)和textarea的宽度设置为500px在IE6和Chrome中不起作用,只能在FF2(未测试其他浏览器),IE和

Setting the width of both the textbox (ie. input type="text") and the textarea to 500px doesn't work in IE6 and Chrome, only works fine in FF2 (haven't tested other browsers), IE and Chrome add two pixels to the textbox.

所有元素的填充和边距均使用

Padding and margin is set to 0 on all elements using

*
{
margin: 0px;
padding: 0px;
}

将doctype从xhtml 1.0 transition更改为strict不起作用。 / p>

Changing the doctype from xhtml 1.0 transitional to strict didn't work too.

推荐答案

你需要明确设置一个1px的边框,使宽度为498像素,或者使边框0和宽度500px后者将使输入不可能看到,除非你知道它在那里,所以从那里它只是一个造型问题。

You need to explicitly set a border of 1px and make the width 498px, or make the border 0 and the width 500px, although the latter will make the input impossible to see unless you know it's there, so from there it's just a styling issue.

这篇关于如何使文本框和textarea相同宽度的交叉浏览器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆