js+css实现树状多级复选框多选框效果代码
代码语言:html
所属分类:其他
代码描述:js+css实现树状多级复选框多选框效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.tree {
font-family: Arial,sans-serif;
line-height: 1.5
}
.tree ul {
list-style-type: none;
padding-left: 20px
}
.tree li {
position: relative;
margin: 5px 0
}
.tree label {
cursor: pointer;
display: flex;
align-items: center
}
.tree input[type="checkbox"] {
margin-right: 8px
}
.tree .toggle {
cursor: pointer;
margin-right: 5px;
width: 15px;
text-align: center
}
.tree .children {
display: none
}
.tree .expanded>.children {
display: block
}
.tree .indeterminate {
color: #666
}
</style>
</head>
<body>
<h1>多级复选框示例</h1>
<div class="tree">
<ul>
<li>
<label>
<input type="checkbox" class="parent-checkbox">
<span class="toggle">+</span>
水果
</label>
<ul class="children">
<li>
<label>
<input type="checkbox" class="parent-checkbox">
<span class="toggle">+</span>
热带水果
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0