color-thief实现图片相册列表主色调过滤筛选效果代码
代码语言:html
所属分类:画廊相册
代码描述:color-thief实现图片相册列表主色调过滤筛选效果代码
代码标签: color-thief 图片 相册 列表 主色调 过滤 筛选
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
*,
::before,
::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
img {
max-width: 100%;
display: block;
}
/* reset button */
button {
appearance: none;
background-color: transparent;
border: none;
cursor: pointer;
outline: none;
padding: 0;
margin: 0;
font-family: inherit;
font-size: inherit;
color: inherit;
text-decoration: none;
text-transform: none;
line-height: normal;
overflow: visible;
}
body {
min-height: 100svh;
padding: 2rem;
background-color: #121212;
color: white;
font-family: system-ui;
display: grid;
place-content: center;
}
.wrapper {
width: 100%;
max-width: 800px;
}
h1 {
font-size: 1.2rem;
font-weight: 300;
text-align: center;
}
.filters {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
gap: 1rem;
margin-block: 2rem;
}
.filters input {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
.filters label {
border-radius: 50%;
width: 1.5rem;
height: 1.5rem;
background-color: rgba(var(--c), 1);
cursor: pointer;
position: relative;
outline: 1px solid #ffffff90;
outline-offset: 0px;
transition: outline 300ms ease-in-out, outline-offset 300ms ease-in-out;
}
.filters label:hover {
outline-style: dashed;
outline-offset: 4px;
}
.filters label:has(input:checked) {
outline-offset: 4px;
}
.filters > button {
transition: scale 300ms ease-in-out;
border: none;
outline: none;
width: 2rem;
height: 2rem;
display: grid;
place-content: center;
}
.filters > button:focus-visible,
.filters > button:hover {
scale: 1.25;
}
.image-gallery {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr));
margin-in.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0