My Technical Notes

Thursday, 11 December 2014

Less.css - Preventing the repetition of long selectors

In Less, we can prevent the repetition of very long selectors, by using variables.


@checkradio-label : ~'input[type="checkbox"] ~ label, input[type="radio"] ~ label';

p {
    @{checkradio-label} {
        display: inline;
    }
}

span {
    @{checkradio-label} {
        display: block;
    }
}

No comments: