[英]Why is only some of my CSS being applied?
我不知道為什么,但無論我做什么,在報名的灰色邊框tbody
不會消失。 我試過使用類(與ID結合使用,因此不重要),我試過使用偽類( :4th-child {border:none}
),實際上唯一可行的方法是取消使用來自#signup td:
的整個border-right:1px solid gray
,這並不是一個好選擇。 以下是相關代碼:
的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;
}
謝謝!
您的nth-child語法錯誤
#signup td:nth-child(4) {
border: none;
}
也許更好的方法是使用最后一個孩子
#signup td:last-child {
border: none;
}
或者,您可以在td中添加一個類:
<td class="submitrow"><input type="submit" value="Sign Up"></td>
...
#signup td.submitrow {
border: none;
}
您需要關閉<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;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.