2013-05-06 5 views
11

का उपयोग कर रहा less उपयोग कर रहा हूँ और एक margin-bottom 10px की के लिए पिछले इनपुट प्राप्त करने की कोशिश। मेरे पास यह है, लेकिन यह काम नहीं कर रहा है, और अंतिम इनपुट पर मार्जिन-तल लागू नहीं कर रहा है। कोई विचार क्यों?कम सीएसएस पिछले वाले बच्चे चयनकर्ता

input { 
    margin-bottom: 0px; 

    &:last-child { 
    margin-bottom: 10px; 
    } 
} 

और एचटीएमएल

<form id="auth-form"> 
    <input id="ember367" class="ember-view ember-text-field" placeholder="Email" type="email" name="email"> 
    <input id="ember368" class="ember-view ember-text-field" placeholder="Password" type="password" name="password"> 
    <div class="clear"></div> 

    <a class="pull-left forgot-password">Forgot password?</a> 
    <button class="pull-right" data-ember-action="1" type="button">Sign In</button> 
</form> 

उत्तर

22

आपकी आखिरी input अंतिम संतान नहीं है - कि आपके button होगा।

उपयोग :last-of-type बजाय पिछले input चयन करने के लिए:

input { 
    margin-bottom: 0px; 

    &:last-of-type { 
    margin-bottom: 10px; 
    } 
} 
संबंधित मुद्दे