我想使用選擇器最後一種類型來定位我的應用程序中的每個表單中的最後一個輸入。最後一種類型的選擇器不按預期工作
這就是HTML:
.form-input:last-of-type {
margin-bottom: 10px;
}
<form role="form"
method="POST"
action="{{ route('login') }}">
{{ csrf_field() }}
<div class="form-input">
<label>Username</label>
<input id="email"
placeholder="Enter your email"
type="email"
name="email"
value="{{ old('email') }}"
required autofocus>
</div>
<div class="form-input"> <!-- That's the element I want to target-->
<label>Password</label>
<!-- or this one -->
<input id="password"
placeholder="Enter your password"
type="password"
name="password"
required>
</div>
<div class="buttonWrapper">
<button type="submit">Login</button>
</div>
<div style="padding-bottom: 20px;" class="text--center">
<a class="text--uppercase text--condensed" href="">
Forgot Your Password?
</a>
</div>
</form>
基本上我想最後.FORM輸入級有更多的填充,底部或最後.FORM輸入的輸入有更多margin-bottom(效果相同)。
我試圖用這樣的:
該代碼的目標也是第一次輸入,將每個輸入之間的餘量。
我也試過:最後一個孩子,但如果有更多的節點下我想要的目標不工作。
有沒有辦法解決這個問題?
我想將每個表單標籤中的每個最後一個輸入標籤作爲目標。我應該在某處添加破折號嗎? – ste
類型的最後一個只適用於直接父項,所以如果在該輸入周圍有一個包裝div(它將查找該包裝的最後一個輸入),則不能定位該表單的最後一個輸入元素。 – delinear