html - Change the style of an input only when it is followed by a span -
this question has answer here:
- is there “previous sibling” css selector? 12 answers
how can target <input>
when there <span>
after it?
<fieldset> <p>normal input</p> <div> <input name=""> <span><i class="icon-cart"></i></span> </div> </fieldset>
input + span {}
work if <span>
before <input>
in case after <input>
- there way target without using javascript or adding classes parent container?
as can see in image below, want change input border-radius merge span icon on other scenarios.
if want add class say, use jquery this:
$('span').prev('input').addclass('test');
or add border-radius:
$('span').prev('input').css('border-radius','3px');
Comments
Post a Comment