Semantic-UI icon indicating copy to clipboard operation
Semantic-UI copied to clipboard

Checkbox bugged on box-sizing: border-box

Open Bantam opened this issue 13 years ago • 6 comments

Fiddle showing issue, check the box to see checkmark. http://jsfiddle.net/dG8RN/3/

When you have a global style that applies border-box to all elements like this:

*, *:before, *:after {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    -ms-box-sizing: border-box;
    box-sizing: border-box;
}

It breaks the checkbox, adding:

.ui.checkbox label:after {
    box-sizing: content-box;   
}

fixes it. I wouldn't normally bring up an issue that stems from applying styles like this but none of the other elements seem affected by applying border-box and http://www.paulirish.com/2012/box-sizing-border-box-ftw/ seems like a practice used by a few people these days.

Bantam avatar Oct 17 '13 20:10 Bantam

I think its actually related to the font

Taking off Font-family: "Open Sans"; on semantic-ui.com seems to make it have the same off alignment. I'm a bit worried about the fix but i'll see what i can do.

jlukic avatar Oct 18 '13 00:10 jlukic

@jlukic what about icon fonts? Is there any way to use the checkmark icon; or the unicode checkmark if icons aren't available? I'm guessing the icon code would have to be changed to implement U+2713, so that the normal font-fallback would work.

brigand avatar Oct 18 '13 00:10 brigand

Yeah it was originalyl done with UTF8 checkmarks, but those things are damn ugly. http://en.wikipedia.org/wiki/Tick_(check_mark)

Fixed for 0.7.0 though, just had to adjust some fun css stuff..

jlukic avatar Oct 18 '13 23:10 jlukic

@jlukic remember to check how it works if icons aren't loaded. Some people won't be including icons (I'd guess 5% of users); and basic elements like checkboxes shouldn't require them.

brigand avatar Oct 18 '13 23:10 brigand

Yeah, it uses a trick with border and `transform`` https://github.com/jlukic/Semantic-UI/blob/master/rtl/less/modules/checkbox.less#L101

jlukic avatar Oct 19 '13 00:10 jlukic

I change it as below code and it work's fine:

.ui.checkbox .box:after, .ui.checkbox label:after { -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter: alpha(opacity=0); opacity: 0; content: ''; position: absolute; background: transparent; border: 0.2em solid #333333; border-top: none; border-right: none; -webkit-transform: rotate(-45deg); -ms-transform: rotate(-45deg); transform: rotate(-45deg); box-sizing: content-box; }

syrein avatar Aug 09 '14 09:08 syrein