div+css实现图文相册排列悬浮放大效果代码
代码语言:html
所属分类:画廊相册
代码描述:div+css实现图文相册排列悬浮放大效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @import url('https://fonts.googleapis.com/css2?family=Montserrat&display=swap'); body { margin: 0; min-height: 100vh; display: grid; place-items: center; } .gallery { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 100px; gap: 0px 20px; width: clamp(70vmin, 900px, 90%); &:has(img:hover) img:not(:hover) { filter: brightness(0.35); } & img { object-fit: cover; width: 100%; height: 100%; clip-path: polygon(0 20px, 100% 0, 100% calc(100% - 20px), 0 100%); transition: clip-path 0.5s, transform 0.5s, filter 0.75s; transform: scale(1); &:nth-child(3n):not(:nth-last-child(-n+4)) { grid-row: span 2; } &:nth-child(14n):not(:nth-last-child(-n+4)) { grid-row: span 2; } &:hover { transform: scale(1.3); z-index: 1; width: 100%; aheight: auto; aaspect-ratio: 1; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); transition: clip-path 0.5s, transform 0.5s, filter 0.5s; } } & .spacer { background: #c00; clip-path: polygon(0 20px, 100% 0, 100% calc(100% - 20px), 0 100%); box-sizing: border-box; } & .quote { grid-row: span 3; margin: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 20px; color: #eee; font-family: Montserrat; font-size: 0.9em; & span { text-wrap: balance; margin: 0 auto 15px auto; max-width: 80%; line-heigh.........完整代码请登录后点击上方下载按钮下载查看
网友评论0