自适应居中左对齐网格布局

代码语言:html

所属分类:布局界面

代码描述:自适应居中左对齐网格布局,采用grid-template布局方式

代码标签: 中左 对齐 网格 布局

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">

    <style>
        body {
            box-sizing: border-box;
            display: grid;
            place-content: center;
            grid-gap: 0.75em;
            grid-template: repeat(auto-fit, 10em)/repeat(auto-fit, 15em);
            margin: 0;
            padding: 0.75em;
            min-height: 100vh;
            background: #555;
        }

        img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            border-radius: 4px;
            box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.7);
            filter: sepia(1);
        }
    </style>

</head>
<body translate="no">
    <a href='#'><img src="http://repo.bfw.wiki/bfwrepo/image/5d653b1fc8bc9.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_300,h_200,/quality,q_90" /></a>
    <a href='#'><img src="http://repo.bfw.wiki/bfwrepo/image/5d653b1fc8bc9.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_300,h_200,/quality,q_90" /></a><a href='#'><img src="http://repo.bfw.wiki/bfwrepo/image/5d653b1fc8bc9.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_300,h_200,/quality,q_90" /></a>
    <a href='#'><img src="http://repo.bfw.wiki/bfwrepo/image/5d653b1fc8bc9.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_300,h_200,/quality,q_90" /></a>
    <a href='#'><img src="http://repo.bfw.wiki/bfwrepo/image/5d653b1fc8bc9.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_300,h_200,/quality,q_90" /></a>
    <a href='#'><img src="http://repo.bfw.wiki/bfwrepo/image/5d653b1fc8bc9.png?x-oss-process=image/auto-or.........完整代码请登录后点击上方下载按钮下载查看

网友评论0