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
2010-05-02 10:17:12
tried text-align. It doesn't do anything.The reason it is centered is because of width being 100%
nick
2010-05-02 10:31:34
I have changed my answer and I have tested my solution.
Finbarr
2010-05-02 15:06:37
A:
Check this
input.checkbox
{
text-align: left;
margin: 0 auto;
}
Nasser Hadjloo
2010-05-02 10:47:45
+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
2010-05-02 10:50:05