This is a migrated thread and some comments may be shown as answers.

checkbox label before checkbox input

2 Answers 1160 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Roger
Top achievements
Rank 1
Roger asked on 25 Feb 2016, 05:58 PM

Hi, i'm wondering if it is possible to style a checkbox such that the label text is before the checkbox control, rather than the other way around.

My markup being something like so:

    <input id="wid" class="ax-unselectable k-checkbox" type="checkbox"> <label for="wid class="k-checkbox-label">label text</label>

There are a number of :before and :after rules associated with k-checkbox-label, but i don't see any obvious mechanism to get the label to come first.

Anyone ever done or requested that?

 

Thanks

roger

2 Answers, 1 is accepted

Sort by
0
Accepted
Alex Gyoshev
Telerik team
answered on 29 Feb 2016, 12:35 PM

Hello Roger,

The Kendo UI checkbox styling requires the rendering to have first the checkbox, then the label tag, so that the latter can be styled, based on the checkbox state:

    .k-checkbox:checked + .k-checkbox-label {}

However, you can have more than one label per input -- leave the k-checkbox-label blank, and place the text in a different label tag, before the checkbox:

    <label for="wid">label text</label>
    <input id="wid" class="ax-unselectable k-checkbox" type="checkbox">
    <label for="wid" class="k-checkbox-label"></label>

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Roger
Top achievements
Rank 1
answered on 29 Feb 2016, 06:27 PM
That seems to do the trick. Thanks.
Tags
General Discussions
Asked by
Roger
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Roger
Top achievements
Rank 1
Share this question
or