CSS3樣式複選框和單選按鈕看起來更漂亮。只有一個input元素。在線demo
源碼:https://github.com/jaywcjlove/magic-inputcss
$ npm install magic-input
你須要引入 dist/magic-input.css
或者dist/magic-input.min.css
文件到你的工程或者HTML中。若是你使用Stylus 你就可使用 magic-input.styl
文件html
<link rel="stylesheet" type="text/css" href="dist/magic-input.min.css">
<input type="checkbox" class="mgc-switch mgc-sm" checked /> <input type="checkbox" class="mgc-switch" /> <input type="checkbox" class="mgc-switch mgc-lg" checked />
<input type="checkbox" class="mgc" checked/> Default <input type="checkbox" class="mgc mgc-primary" checked /> Primary <input type="checkbox" class="mgc mgc-success" /> Success <input type="checkbox" class="mgc mgc-info" checked /> Info <input type="checkbox" class="mgc mgc-warning" checked /> Warning <input type="checkbox" class="mgc mgc-danger" checked /> Danger
<input type="radio" name="radio3" class="mgr mgr-sm"/> Default <input type="radio" name="radio3" class="mgr mgr-primary" /> Primary <input type="radio" name="radio3" class="mgr mgr-success mgr-lg" checked/> Success <input type="radio" name="radio3" class="mgr mgr-info mgr-sm" /> Info <input type="radio" name="radio3" class="mgr mgr-warning" /> Warning <input type="radio" name="radio3" class="mgr mgr-danger mgr-lg" /> Danger
sm
是 small
的縮寫 , lg
是 large
縮寫ios
在 Checkbox中設置下面classgit
mgc-sm
mgc-lg
github
在 Radio Button中設置下面npm
mgr-sm
mgr-lg
bash
在 Checkbox中設置下面classspa
mgc-primary
mgc-info
mgc-success
mgc-warning
mgc-danger
code
在 Radio Button中設置下面mgr-primary
mgr-info
mgr-success
mgr-warning
mgr-danger
htm
關注公衆號