本文摘自PHP中文网,作者藏色散人,侵删。
input能改变css样式,其修改css样式的方法:1、利用伪类元素改变radio样式;2、利用label指向input,并通过改变label样式来达到效果即可。
本教程操作环境:Dell G3电脑、Windows7系统、HTML5&&CSS3版本。
推荐:《css视频教程》
改变input框默认css样式的方法:
一:利用伪类元素改变radio样式 (此方法无需添加额外的标签,更便捷)
1 2 3 4 5 6 7 | .div input[type=radio]::after {
position: absolute;
width: 25px;
height: 25px;
background: url(../img/inputBG.jpg) no-repeat;
background-size: 100% 100%;
}
|
二:利用label指向input,通过改变label样式来达到效果
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <html>
<input type= "checkbox" checked= "checked" id= "aa" /><label for = "aa" ></label>
</html>
<style>
input[type=checkbox]{
visibility: hidden;
}
label{
width:20px;
height:20px;
border:1px solid #707070;
}
input[type=checkbox]:checked + label{
background: url(../img/duigou.jpg)no-repeat;
background-size: 100% 100%;
}
</style>
|
以上就是input能改变css样式吗的详细内容,更多文章请关注木庄网络博客!
相关阅读 >>
css如何隐藏x轴坐标
css %是什么单位
html中设置字体的属性有哪些
手把手教你使用css自定义好看的滚动条样式!
css reset是什么意思?
css中背景图片有哪些属性
css中@有哪些用法
css如何设置黑体样式
css间距怎么设置
css如何设置渐变色
更多相关阅读请进入《css》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » input能改变css样式吗