【发布时间】:2010-08-17 05:39:22
【问题描述】:
我正在尝试将<button> 浮动到右侧。 <button> 在 <form> 之外,但在同一行。由于某种原因,这在 FF 中不起作用。我将表单背景设为红色,发现 <button> 仍在 FF 中的 <form> 中,尽管它不是!其他所有浏览器都可以正常工作,<button> 不在<form> 中。
屏幕截图:(左边是chrome...带有http://的那个,右边是Firefox
alt text http://img375.imageshack.us/img375/3824/ffchrome.png
HTML:
<form>
<input type="url" placeholder="http://" />
<input type="submit" value="Crypt" />
</form>
<button type="button"> ? </button>
CSS:(去掉了不必要的代码)
section.crypter {
padding: 25px;
}
section.crypter form {
display: block;
float: left;
background: red;
}
/* Input */
section.crypter input[type="url"] {
border:1px solid #666;
color: #939393;
font: italic bold 1.7em Verdana, Arial, Serif;
outline: 0;
padding: 10px 10px;
width: 240px;
}
section.crypter input[type="submit"] {
border:1px solid #666;
color: #000;
font: 2em Verdana, Arial, Serif;
margin:0 0 0 -10px;
padding: 8px 20px;
}
section.crypter input[type="submit"]::-moz-focus-inner {
border: 0;/* Firefox hack */
}
section.crypter button {
display: block;
float: right;
padding: 10px 25px;
}
【问题讨论】:
-
没有你的 CSS 很难说。
-
刚接触编码才几个月,我不知道 Firefox 有这些问题。 :/ 认为 IE 是坏人。
-
向我们展示 CSS + 什么版本的 Firefox?你测试过多个版本吗?不要这么快责怪 Firefox,你可能不是以“最佳实践”的方式来做这件事的。
-
@Kawohi,CSS 规范中存在足够多的歧义,以至于浏览器可以显示不同的内容而不会成为“坏人”。 IE 以违反规范着称,但仅仅因为某些东西在 WebKit 中看起来不错,并不能保证它在 Firefox 中看起来不错。
-
Firefox 3.6.8 我还添加了 CSS