css实现图片相册网格拼贴布局效果代码
代码语言:html
所属分类:画廊相册
代码描述:css实现图片相册网格拼贴布局效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @import "https://unpkg.com/open-props/open-props.min.css"; @import "https://unpkg.com/open-props/normalize.min.css"; *, *:after, *:before { box-sizing: border-box; } body { display: grid; place-items: center; min-height: 100vh; font-family: 'Google Sans', sans-serif, system-ui; width: 100vw; overflow-x: hidden; background: var(--surface-2); } ul { --big-tile-size: 50vmin; --scale: 0.4; --rotation: 270deg; --tile-size: calc(var(--big-tile-size) / 3); list-style-type: none; padding: 0; margin: 0; display: grid; gap: 1vmin; grid-template: repeat(9, var(--tile-size)) / repeat(9, var(--tile-size)); position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(var(--scale)); } img { --rotation: -270deg; --scale: 1; height: 200%; min-width: 200%; aspect-ratio: 1; -o-object-fit: cover; object-fit: cover; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } li { padding: 0; position: relative; background: hsl(0 0% 75% / 0.2); max-inline-size: 100%; } li { grid-column: var(--x1, auto) / var(--x2, auto); grid-row: var(--y1, auto) / var(--y2, auto); } li { border-radius: var(--radius-3); overflow: hidden; } </style> </head> <body > <main> <ul> <li style="--x1: 2; --x2: 6; --y1: 1; --y2: 4;"> <img src="//repo.bfw.wiki/bfwrepo/image/5e62eef0d452a.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_300,h_300,/quality,q_90" alt=""> </li> <li style="--x1: 6; --x2: 8; --y1: 2; .........完整代码请登录后点击上方下载按钮下载查看
网友评论0