0

我不知道为什么,但无论我做什么,SIGN UP 的灰色边框tbody都不会消失。我尝试过使用类(与 ID 结合,所以这不重要),我尝试过使用伪类 ( :4th-child {border:none}),实际上唯一有效的方法是border-right:1px solid gray#signup td:真的是一个不错的选择。以下是相关代码:

HTML

  <div id="signup">
    <form action="" method="GET" id="form">
      <fieldset>
        <table>
          <thead>
            <tr>
              <th><label for="signupname">Sign Up</label></th>
            </tr>   
          </thead>
          <tbody>
            <tr>
              <td><input id="signupname" placeholder="Your Name"></td>
              <td><input type="password" placeholder="Password"></td>
              <td><input type="email" placeholder="Email (optional)"></td>
              <td><input type="submit" value="Sign Up"></td>
            </tr>
          </tbody>
        </table>
      <fieldset>
    </form>
  </div>

CSS

#signup{
  height:28%;
  min-height:90px;
  background-color:seashell;
  padding-top:1px;
  margin-top:-1px;
}
#signup label{
  font:200% Corbel;
  text-shadow:0px 1px 0px white;
  color:maroon;
  font-weight:bold;
}
#signup table{
  margin:2% auto;
}
#signup td{
  padding:5px 50px;
  border-right:1px solid gray;
}
#signup th{
  padding:0 50px;
}
#signup input{
  font:130% Trebuchet MS;
  padding:5px 5px;
}

谢谢!

4

2 回答 2

2

您的 nth-child 语法错误

#signup td:nth-child(4) {
  border: none;
}

或者甚至更好的是使用 last-child

#signup td:last-child {
  border: none;
}

或者,您可以在 td 中添加一个类:

<td class="submitrow"><input type="submit" value="Sign Up"></td>

...

#signup td.submitrow {
  border: none;
}
于 2013-09-03T00:47:14.133 回答
1

您需要关闭<fieldset>标签。尝试这个:

  <div id="signup">
    <form action="" method="GET" id="form">
      <fieldset>
        <table>
          <thead>
            <tr>
              <th><label for="signupname">Sign Up</label></th>
            </tr>   
          </thead>
          <tbody>
            <tr>
              <td><input id="signupname" placeholder="Your Name"></td>
              <td><input type="password" placeholder="Password"></td>
              <td><input type="email" placeholder="Email (optional)"></td>
              <td><input type="submit" value="Sign Up"></td>
            </tr>
          </tbody>
        </table>
      </fieldset>
    </form>
  </div>

#signup{
  height:28%;
  min-height:90px;
  background-color:seashell;
  padding-top:1px;
  margin-top:-1px;
}
#signup label{
  font:200% Corbel;
  text-shadow:0px 1px 0px white;
  color:maroon;
  font-weight:bold;
}
#signup table{
  margin:2% auto;
}
#signup td{
  padding:5px 50px;
  border-right:1px solid gray;
}
#signup th{
  padding:0 50px;
}
#signup input{
  font:130% Trebuchet MS;
  padding:5px 5px;
}
于 2013-09-03T00:44:26.800 回答