views:

30

answers:

3

I am setting all inputs to a 100% width via CSS. However, checkboxes are center aligned for some reason. Anyway to counter this? I don't want to have to use attribute selection via css since they're not fully supported.

A: 

You need to wrap your checkbox in another element:

<div class="checkbox">
    <input type="checkbox" value="check-value">Human readable value
</div>

In CSS:

.checkbox {
    width: 100%;
    text-align: left;
}
Finbarr
tried text-align. It doesn't do anything.The reason it is centered is because of width being 100%
nick
I have changed my answer and I have tested my solution.
Finbarr
A: 

Check this

input.checkbox 
{ 
    text-align: left; 
    margin: 0 auto;
}
Nasser Hadjloo
+1  A: 

You need to set the width back to auto (width: auto).

If you don't want to use attribute selectors, then you must find another selector that matches the checkboxes. This may well involve adding additional markup (such as a class).

David Dorward