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

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -