css grid布局实现单个背景网格切割效果代码
代码语言:html
所属分类:布局界面
代码描述:css grid布局实现单个背景网格切割效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> * { box-sizing: border-box; } body { --gap: calc(1rem + 0.125vw); margin: 0; block-size: 100dvh; } .grid-container { /* */ block-size: 100%; padding: var(--gap); /* */ display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); .grid-item { /* */ background-image: url(//repo.bfw.wiki/bfwrepo/image/658b6bf55c45a.png); background-size: cover; background-attachment: fixed; &:nth-of-type(2) { grid-column: 2 / 4; } &:nth-of-type(6) { grid-column: 1 / 3; } &:nth-of-type(9) { grid-column: 3 / 4; grid-row: 3 / 5; } } } .original { position: absolute; bottom: var(--gap); right: var(--gap); z-index: 1; background-color: #e43d82; .........完整代码请登录后点击上方下载按钮下载查看
网友评论0