html如何创建复选框和单选按钮,css3自定义单选按钮和复选框

这篇博客详细介绍了如何使用HTML、CSS和JavaScript实现网页的基本样式设置和交互功能。内容包括盒模型、选择器应用、响应式布局以及事件处理。通过实例展示了如何创建一个全屏黑色背景的容器,并设置输入框的样式,同时利用CSS3实现了一个带有旋转45度的勾选标记。此外,还探讨了颜色、字体和浮动布局等关键概念。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

* {

margin:0;

padding:0;

box-sizing:border-box;

-webkit-box-sizing:border-box;

-moz-box-sizing:border-box;

text-decoration:none;

list-style:none;

-webkit-touch-callout:none;

-webkit-user-select:none;

-webkit-tap-highlight-color:transparent;

-webkit-appearance:none;

-webkit-font-smoothing:antialiased;

font-family:"microsoft yahei",Arial,Helvetica,sans-serif;

}

.max_box {

width:100%;

height:100%;

background-color:black;

position:absolute;

}

input[type='checkbox'] {

width:0;

}

.wrapper {

width:580px;

height:130px;

margin:100px auto;

padding:0 20px;

}

.wrapper > h3 {

font-size:16px;

color:snow;

}

li {

width:120px;

height:50px;

float:left;

padding:12px 0;

}

li:nth-child(4n+1) ~ li:nth-child(4n+3) {

margin-left:20px;

}

label {

width:125px;

height:32px;

display:block;

cursor:pointer;

}

.check_container {

width:18px;

height:18px;

border:1px solid snow;

float:left;

margin-top:6px;

position:relative;

}

input[type='checkbox']:checked + .check_container:before {

content:'';

position:absolute;

width:3px;

height:10px;

border-right:2px solid snow;

border-bottom:2px solid snow;

transform:rotate(45deg);

-webkit-transform:rotate(45deg);

-moz-transform:rotate(45deg);

-ms-transform:rotate(45deg);

-o-transform:rotate(45deg);

left:6px;

}

input[type='checkbox']:checked + .check_container + span {

color:lightseagreen;

}

h3 + ul label > span {

display:block;

float:left;

width:107px;

height:30px;

line-height:30px;

color:hotpink;

text-align:left;

font-size:16px;

padding-left:12px;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值