我可以使用CSS更改复选框的大小吗? [英] Can I change the checkbox size using CSS?

查看:97
本文介绍了我可以使用CSS更改复选框的大小吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在所有浏览器中使用CSS或HTML设置复选框的大小?

Is it possible to set the size of a checkbox using CSS or HTML across browsers?

widthsize在IE6 +中有效,但不适用于Firefox,即使我设置了较小的尺寸,该复选框也保持16x16的大小.

width and size work in IE6+, but not with Firefox, where the checkbox stays 16x16 even if I set a smaller size.

推荐答案

这有点难看(由于放大),但是它可以在大多数较新的浏览器上使用:

It's a little ugly (due to the scaling up), but it works on most newer browsers:

input[type=checkbox]
{
  /* Double-sized Checkboxes */
  -ms-transform: scale(2); /* IE */
  -moz-transform: scale(2); /* FF */
  -webkit-transform: scale(2); /* Safari and Chrome */
  -o-transform: scale(2); /* Opera */
  transform: scale(2);
  padding: 10px;
}

/* Might want to wrap a span around your checkbox text */
.checkboxtext
{
  /* Checkbox text */
  font-size: 110%;
  display: inline;
}

<input  type="checkbox" name="optiona" id="opta" checked />
<span class="checkboxtext">
  Option A
</span>
<input type="checkbox" name="optionb" id="optb" />
<span class="checkboxtext">
  Option B
</span>
<input type="checkbox" name="optionc" id="optc" />
<span class="checkboxtext">
  Option C
</span>

这篇关于我可以使用CSS更改复选框的大小吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆