本文主要包含css3美化checkbox,css3 checkbox,css3 checkbox样式,jquery css3,html5 css3 jquery等相关知识,佚名 希望在学习及工作中可以帮助到您
show()/hide()的实现
show()/hide()的实现主要控制元素的display属性。
html:
- <div id="box">
- <input type="checkbox" id="sh"/>
- <label for="sh">show/hide</label>
- <div id="shbox">
- 点击上面的show/hide实现show()/hide()
- </div>
- </div>
css:
</div>- #box{
- position:relative;
- }
- #box *:not(#shbox){
- display:inline-block;
- }
- input{
- position:absolute;
- left:-10000000px;
- }
- :checked~#shbox{
- display:none;
- }
- label{
- width:100px;
- height:30px;
- line-height:30px;
- text-align:center;
- border:1px solid green;
- position:absolute;
- left:0px;
- cursor:pointer;
- border-radius:5px;
- }
- #shbox{
- background:#ccc;
- color:red;
- width:200px;
- height:200px;
- border:1px solid blue;
- box-sizing:border-box;
- padding:50px;
- position:absolute;
- top:50px;
- }
运行结果:https://jsfiddle.net/dwqs/1LykzL2f/1/embedded/result/
fadeIn()/fadeOut()的实现
fadeIn()/fadeOut()的实现主要是控制元素的opcity属性。html依旧采用上面的,修改css如下:
</div>- :checked~