css使用details标签实现水平折叠面板效果代码
代码语言:html
所属分类:布局界面
代码描述:css使用details标签实现水平折叠面板效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @supports selector(::details-content) { .warning { display: none; } } .accordion-wrapper { display: flex; flex-direction: row; gap: 1rem; width: min-content; margin: 0 auto; } details { display: flex; flex-direction: row; background: transparent; color: white; height: 30rem; border-radius: 2rem; overflow: hidden; /* To make the image work …*/ position: relative; z-index: 1; /* Hide marker */ ::marker { content: ''; } /* The image is tucked in the summary, because otherwise it would be hidden when not [open] as it ends up in the ::details-content pseudo */ summary img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; transition: filter 0.5s ease; } /* Animate the image */ &[open] summary img { filter: brightness(0.5); } summary { padding: 1rem 1em; width: 5rem; flex-shrink: 0; /* Prevent shrinking */ text-align: center; span { display: grid; place-content: center; width: 100%; aspect-ratio: 1; border-radius: 50%; background: rgb(0 0 0 / 0.25); } &:focus { outline: none; } } .details-content-wrappe.........完整代码请登录后点击上方下载按钮下载查看
网友评论0