对输入类型文本和复选框使用不同的css(Use different css for input type text and checkbox)

当我尝试更改输入复选框的宽度时,我遇到了麻烦。

所有输入都是宽度:200px(文本,按钮,复选框)。 但我需要宽度:20px仅用于复选框。

可能吗?

I'm getting trouble when i try to change the width of my input checkbox.

all inputs are width:200px (text, button, checkbox). But i need a width:20px only for checkbox.

Is it possible?

最满意答案

您可以使用:

input[type="checkbox"] {width:20px}

但这并不完全兼容浏览器。 如果您向复选框添加类,则所有浏览器都会识别,即。

<input type="checkbox" class="checkbox" />

然后使用:

.checkbox {width:20px}

You can use:

input[type="checkbox"] {width:20px}

but this is not completely browser compatible. All browsers will recognise if you add a class to your checkboxes, ie.

<input type="checkbox" class="checkbox" />

then use:

.checkbox {width:20px}

更多推荐

px,width,宽度,电脑培训,计算机培训,IT培训"/> <meta name="description"