0

我的错误 div 有以下 css:

.side_error {
width: 325px;
position: absolute;
top: 0;
left: -335px;
padding: 8px 0 0 0;
text-align: right;
color: #FF0000;
display: block;
}

以及我的表 td 的以下 css:

.main_form td {
padding: 5px 0 5px 0;
position: relative;
}

还有我的 HTML 结构:

<table class="main_form" align="center">
<tbody>
<tr><td class="title_area"><h2>Create an account</h2><span>(or <a href="#">Sign In</a>)</span></td></tr>
<tr><td><div class="side_error">please enter your full name &gt;&gt;</div><input type="text" name="fullname" placeholder="Full Name" class="input"></td></tr>
<tr><td><input type="text" name="email" placeholder="Email" class="input"></td></tr>
<tr><td><input type="password" name="pass1" placeholder="Password" class="input"></td></tr>
<tr><td><input type="password" name="pass2" placeholder="Repeat Password" class="input"></td></tr>
<tr><td class="submit_area"><span><input type="checkbox" name="terms" value="yes" id="rm"><label for="rm"> I agree to <a href="#">**** Terms</a>.</label></span><input type="submit" name="submit" class="submit" value="Create Account"></td></tr>
</tbody>
</table>

带有类的 divside_error似乎完全按照我想要的方式出现在每个浏览器中,但在 Firefox(版本 17.0.1)中它根本不显示,即使当我使用 Firebug 时,悬停 html 代码时 div 也不会着色,它就像它根本不存在。

有任何想法吗?

4

2 回答 2

2

重新组织你的CSS,看看这是否有帮助-

CSS-

.side_error 
{
  width: 325px;
  position: relative;
  top: 20px;
  left: -327px;
  padding: 8px 0 0 0;
  text-align: right;
  color: #FF0000;
  display: inline-block;
}
.main_form td 
{
   position:relative;
   padding: 5px 0 5px 0;
}
table
{
   width:330px;
}​

查看工作中的 Fiddle- DEMO

于 2012-12-13T05:51:09.403 回答
0

删除left: -335px;position: absolute;尝试使用right :10px;

或在内容中添加额外div内容td并分配类:

<tr>
  <td >
    <div class="title_area">
      <h2>
       Create an account</h2><span>(or <a href="#">Sign In</a>)</span></div>
  </td>
</tr>
于 2012-12-13T05:45:44.860 回答