Checkbox style (css)

Cakephp 3.3

How can I have a checkbox away from its text ?
They are always glued one to another.

Here is the Html I get :
<div class=“checkbox”>
<label for=“access-1040”>
<input type=“checkbox” name=“access[]” value=“1040” id=“access-1040”>
Some text here

That is handled by your css files, within /webroot/css/
In there should be a cake.css (I am only guessing that as I run Cake 4), and within that is the section /* Forms */ which has: - label > input,
.input.checkbox label > input {
    margin-right: 1.0rem;

which should be separating the checkbox and label.

Ensure that css is loaded in your templates/layout/default.php with the $this->Html->css( part.
Also check the Dev tools in the browser (F12) and element selector to see if that margin is being overwritten by another style.

Sorry if descriptions / filenames are wrong - I use Cake 4.

Was it so easy ?
Works perfectly !
Thank you very much for taking time to answer and show me the way.

1 Like