html - Custom image for checkbox -- how to when separating the label and checkbox? -
using css, able replace normal checkbox custom image. problem is, when seen on ipad, can this:
[] text instead of this:
[] text. here's i've got now:
input[type="checkbox"] { visibility: hidden; position: absolute; height: 0; width: 0; } input[type="checkbox"] + label span { display: inline-block; width: 20px; height: 20px; margin: -2px 10px 0 0; vertical-align: middle; background: url(http://qa.walkup.audidriveusa.com/images/checkbox.png) no-repeat; cursor: pointer; } input[type="checkbox"]:checked + label span { background: url(http://qa.walkup.audidriveusa.com/images/checkbox-selected.png) no-repeat; } <div style="width:100px"> <input type="checkbox" class="surveyquestion" id="q6a" name="question_vehicle_more_information" value="audi_a3"> <label for="q6a"><span></span>audi a3 long text wrap</label> </div>
use flex on parent. keep them on same row, , content wrap in individual flex children.
label { display: flex; } input[type="checkbox"] { visibility: hidden; position: absolute; height: 0; width: 0; } input[type="checkbox"] + label span { height: 20px; margin: -2px 10px 0 0; display: block; background: url(http://qa.walkup.audidriveusa.com/images/checkbox.png) no-repeat; cursor: pointer; flex: 0 0 20px; } input[type="checkbox"]:checked + label span { background: url(http://qa.walkup.audidriveusa.com/images/checkbox-selected.png) no-repeat; } <div style="width:100px"> <input type="checkbox" class="surveyquestion" id="q6a" name="question_vehicle_more_information" value="audi_a3"> <label for="q6a"><span></span>audi a3 long text wrap</label> </div>
Comments
Post a Comment