0
                <form class="fin-search-input" method="post" action="../FinServlet">
                    <li><BR><input type="text" name="ticker" placeholder="Ticker*"></li>
                    <li><input type="text" name="fromDate" placeholder="From" id="fromDate"></li>
                    <li><input type="text" name="toDate" placeholder="To" id="toDate"></li>
                    <li><input type="submit" value="search" class="submitButton"></li>
                </form>

最後を除くすべての入力要素を選択するにはどうすればよいですか? これは私が試したものです:

.fin-search-input input:not(:last-of-type){
    height:13px !important;
    width:90%;
    border-radius: 2px;
    -webkit-border-radius: 2px;
    -moz-border-radius: 2px;
    -moz-box-shadow:inset 2px 2px 2px #888;
    box-shadow:inset 2px 2px 2px #888;
  }

この css はどの入力要素にも適用されません。

4

4 に答える 4

2

投稿された HTML の場合、セレクターが間違っているようです。すべて input:last-of-type親要素内にあります。input代わりに、要素内に含まれるものを選択する必要があります:last-of-type li(私が推測します):

.fin-search-input li:not(:last-of-type) input {
    /* css */
}

JS フィドルのデモ

于 2013-07-07T09:37:01.080 に答える
1

これを試しましたか?

.fclass input:not(:last-of-type) { color:red } 
于 2013-07-07T08:34:01.727 に答える
0

:last-childセレクターが機能するはずです。私はそれをチェックしました。代わりに last-of-type を使用してください。:last-of-typeセレクターは、特定の型の親の最後の子であるすべての要素に一致します。

このフィドルをチェック

于 2013-07-07T08:38:29.163 に答える
0

実際、現在のコードは機能します。

:last-childこのように使用できます:not

フィドル

于 2013-07-07T08:38:59.693 に答える