html - Why letter M or W indent are different than other letters? -
looking example:
html
<input type="checkbox" name="jour_semaine[]" id="lundi" value="lundi"/> <label class="checkbox-inline weekday" for="lundi" >l</label> <input type="checkbox" name="jour_semaine[]" id="mardi" value="mardi"/> <label class="checkbox-inline weekday" for="mardi" >m</label> <input type="checkbox" name="jour_semaine[]" id="mercredi" value="mercredi"/> <label class="checkbox-inline weekday" for="mercredi" >w</label> <input type="checkbox" name="jour_semaine[]" id="jeudi" value="jeudi"/> <label class="checkbox-inline weekday" for="jeudi" >j</label> <input type="checkbox" name="jour_semaine[]" id="vendredi" value="vendredi"/> <label class="checkbox-inline weekday" for="vendredi" >v</label> css
/* base label styling */ [type="checkbox"]:not(:checked), [type="checkbox"]:checked { position: absolute!important; left: -9999px!important; } [type="checkbox"]:not(:checked) + label, [type="checkbox"]:checked + label { position: relative; padding-left: 40px; padding-top:6px; margin-bottom:20px; cursor: pointer; font-family:'arial'; } /* checkbox aspect */ [type="checkbox"]:not(:checked) + label:before, [type="checkbox"]:checked + label:before { content: ''; position: absolute; left:0; top: 0; width: 32px; height: 32px; border: 1px solid #ccc; background: #fff; border-radius: 3px; } /* checked mark aspect */ [type="checkbox"]:not(:checked) + label:after, [type="checkbox"]:checked + label:after { content: ' '; background:#ccc; width:20px; height:20px; border-radius:3px; position: absolute; top: 6px; left: 6px; font-size: 24px; line-height: 0.8; color: #000; transition: .2s; } /* checked mark aspect changes */ [type="checkbox"]:not(:checked) + label:after { opacity: 0; transform: scale(0); } [type="checkbox"]:checked + label:after { opacity: 1; transform: scale(1); } .checkbox-inline{display:inline-block;} .weekday{text-indent:-29px; margin-right:60px; font-weight:bold; } .weekday::before{background:none!important;} .weekday::after{z-index:-1;} results
i'm indenting letter negatively center inside box. can see, letters except m , w centered.
i've tried many font-family , nothing, still having offset. typography guru out there explain why twos act differently?
note these <label> text-indent set negative.
all characters have different widths except in mono-space fonts.
rather fighting changing indent, since have exact width set on boxes, can set label width match box width, center text, , remove text-indent , left-padding , should solve alignment issue letters:
[type="checkbox"]:not(:checked) + label, [type="checkbox"]:checked + label { position: relative; padding-top:6px; margin-bottom:20px; cursor: pointer; font-family:'arial'; width:32px; text-align:center; } .weekday{margin-right:60px; font-weight:bold; } 
Comments
Post a Comment