Reputation:
Code:
<div class="BlockContent">
<div class="input">
<div class="icon"> </div>
<input type="text" name="username">
</div>
<div class="input">
<div class="icon"></div>
<input type="password" name="username">
</div>
</div>
CSS:
.BlockContent .input:first{
margin-top: 16px;
}
.BlockContent .input{
margin-bottom: 8px;
}
Tell me please how change line css .BlockContent .input:first
that only first div.input
have style margin-top: 16px;
?
Upvotes: 1
Views: 273
Reputation: 14365
Not a direct answer here, but a better solution. Rather than padding an empty, non-semantic div
, it would be better to add padding or margin on an existing element. For example, you could set top inner padding on the input
container, or top margin on the input itself.
Upvotes: 0
Reputation: 8268
You just missed one word i think.
.BlockContent .input:first-child{
margin-top: 16px;
}
Upvotes: 1