IE 6 和 FireFox 3.6 中的文本框大小不同
在 Fire Fox 3.6 中查看时,我遇到文本框大小问题。 <强><输入 class="dat" type="text" name="rejection_reason" size="51" maxlength="70" onchange="on_change();">
样式如下: .dat { 字体系列:verdana、arial、helvetica; 字体大小:8pt; 字体粗细:粗体; 文本对齐:左对齐; 垂直对齐:中间; 背景颜色:白色; }
Fire Fox 中的文本框大小比 IE6 小一些。
不知道为什么 IE6 和 FireFox 显示不同大小的文本框。
I am facing issues with text box size when veiwing in Fire Fox 3.6.
< input class="dat" type="text" name="rejection_reason" size="51" maxlength="70" onchange="on_change();">
style is as:
.dat {
font-family : verdana,arial,helvetica;
font-size : 8pt;
font-weight : bold;
text-align : left;
vertical-align : middle;
background-color : White;
}
Text box size in Fire Fox is bit smaller than IE6.
Not sure why IE6 and FireFox displaying text box of diff size.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
为不同的网络浏览器引擎开发时的常见问题。
请注意,您可能应该为 FireFox 3.6 而不是 IE6 进行开发,因为 IE6 已设置为微软不再支持的“旧浏览器”。更改您的代码以使其在 FireFox、IE、Chrome、Opera 中正常工作。
查找更多信息:
https://stackoverflow.com/questions/ 72394/开发人员在构建公共网站之前应该了解什么
Normal problem when developing for different web-browser engines.
Note that you maybe should develop for FireFox 3.6 rather than IE6 because IE6 have set to "old browser" that microsoft is not supporting anymore. Change your code to work good in FireFox, IE, Chrome, Opera.
look for more info at:
https://stackoverflow.com/questions/72394/what-should-a-developer-know-before-building-a-public-web-site
尝试在 css 中指定宽度。如果仍然损坏,您可以在宽度字前面附加一个星号作为第二个条目,它仅适用于 IE6。
编辑:感谢您对特殊角色的更新。
Try specifying the width in your css. If that remains broken, you can append an asterisk to the front of the width word as a second entry and it will apply only in IE6.
EDIT: Thanks for the update on the special character.
有了更完整的解释,我只需向经理提供;
IE6 于 2000 年左右构建,忽略了当时的几个重要的 Web 标准。 IE6 在某种程度上是一个“教训”; IE7 更好地遵循这些标准,而 IE8 则更好。
Firefox 是围绕 Netscape/Mozilla 构建的,重要的是,它们尽可能遵循公共标准。 Firefox 的行为很大程度上类似于 Safari、Chrome、Opera 以及众多市场份额很小的浏览器。
商人问:
那么,为什么要支持该标准,而不是支持 IE 这个大佬呢?几乎我们所有的客户都使用 IE!
答案:
因为IE也在慢慢走向标准。如果我们支持 Firefox,那么 IE8 就很容易实现,而且我们可能也会获得几乎没有任何变化的 IE7。 IE6 是这里的美中不足。
如果我们支持 IE6(最初的提议),那么 IE7 是一个特例,IE8 是另一个特例,Firefox 是一个特例,等等。
如果我们能够鼓励用户放弃 IE6,那是我们最好的情况。我相信当 Server 2003 SP1 停止支持时,微软正式终止了对 IE6 的所有支持(包括安全补丁), 2009 年 4 月。 Google已完全停止支持 IE6,例如,礼貌地让用户知道他们需要升级“以获得完整的网站体验”。 IE6NoMore 等网站为运行 IE6 的用户提供了一个非常漂亮的 CSS 弹出窗口,为他们提供了一些升级选项。
但与此同时,由于客户确实使用它,IE6 将继续存在,并且它是最容易且最易于维护的标准,并且我们可以通过破解回到 IE6 直到完成。
With a more full explanation, which I just had to give to a manager;
IE6 was built around 2000, and ignored several significant web standards at the time. IE6 was somewhat of a "lesson learned"; IE7 is better about following those standards, and IE8 is better still.
Firefox was built around Netscape/Mozilla, and importantly, they followed the public standard as much as they could. Firefox largely behaves like Safari, Chrome, Opera, and the tons of tiny-marketshare browsers out there.
Businessperson asks:
So, why support the standard, instead of IE, which is the big kid on the block? Almost all of our customers use IE!
Answer:
Because IE is slowly moving towards the standard, too. If we support Firefox, IE8 is easy, and we probably get IE7 as well with almost no changes. IE6 is the fly in the ointment here.
If we support IE6 - the original proposal - then IE7 is a special case, IE8 is another special case, Firefox is a special case, and so on.
If we can encourage users to move away from IE6, that's our best case scenario. I believe Microsoft officially ended all support - including security patches - for IE6 when Server 2003 SP1 left support, April 2009. Google has stopped supporting IE6 entirely, for example, politely letting users know they need to upgrade "for the full site experience". Sites like IE6NoMore offer a pretty slick CSS popup for those running IE6, giving them a few upgrade options.
But in the meanwhile, since customers do use it, IE6 is here to stay, and it's easiest - and most maintainable - to build to the standards, and hack our way back to IE6 until it's done.
您没有指定其宽度,只是希望它通过 size 属性占用 51 个字符。我建议删除 Size="51" 属性并添加 width:666px; 的样式;
编辑:发表评论后
首先,仅仅因为你可以并不意味着你应该。解决此问题的正确方法是更改所有的 使用 css 类或 css 宽度来定义它们的宽度。
然而,下面的 jQuery 将为每个具有 size 属性的输入 type=text 添加宽度样式
现在,因为这仅影响指定大小的输入,当您触摸每个页面时,您可以删除 size attr 并将其替换为 Css size,所以最终您将不需要这个脚本。
You have not specified its width just that you want it to take 51 charecters via the size attribute. I would suggest removing the Size="51" attribute and adding a style of width:666px;
EDIT: after your comment
Firstly just because you can does not mean you should. The corret way of solving this is changing all of your <input type="text"> to use a css class or css width to define their width.
However the following jQuery will add a width style to every input type=text which has a size attribute
Now since this only effects inputs with size specified, as you touch each page you can remove the size attr and replace it with Css size, so eventuly you will not need this script.
@size 属性给出字符大小。但是,除非您使用等宽字体,否则字符本身的大小并不是明确定义的。另外,不同的渲染引擎可以使用不同的字符间距和/或字距调整规则。因此,最终,该属性只不过是给浏览器的一个模糊提示。
您是否尝试过类似
style = "width:51em;"
的方法?还没有测试过,但 width 属性得到了很好的支持,所以我希望这能起作用。如果您想要更精确的尺寸,也可以使用绝对(像素)单位。希望这有帮助。
The @size attribute gives a size in characters. However, unless you are using monospaced fonts, the size of a character itself is not something that is well-defined. In addition, different rendering engines may use different rules for character spacing and/or kerning. So, at the end, the attribute is no more than a vague hint to the browser.
Have you tried something like
style = "width:51em;"
instead? Haven't tested it, but the width property is well-supported, so I'd hope this would work. You can also use absolute (pixel) units if you want a more exact size.Hope this helps.