div+css实现互锁六边形蜂窝网格图片画廊代码

代码语言:html

所属分类:画廊相册

代码描述:div+css实现互锁六边形蜂窝网格图片画廊代码

代码标签: div css 互锁 六边形 网格 蜂窝 图片 画廊 代码

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

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  
<style>
@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@500&family=Playfair+Display:wght@600&display=swap");

/* =========================================
   1. Core Variables & Math
   ========================================= */
:root {
  --hex-width: 220px;
  --hex-gap: 16px;
  --sqrt3: 1.73205;
  --hex-height: calc(var(--hex-width) * 2 / var(--sqrt3));
  --hex-margin-x: calc(var(--hex-gap) / 2);
  --hex-margin-y: calc(
    (var(--sqrt3) / 4 * var(--hex-gap)) - (0.125 * var(--hex-height))
  );
}

/* =========================================
   2. Base Setup & Ambiance
   ========================================= */
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 50%, #16181f 0%, #08090b 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: "Montserrat", sans-serif;
  overflow-x: hidden;
  padding: 80px 0;
}

.gallery-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  perspective: 1000px;
}

.hex-grid {
  display: flex;
  flex-wrap: wrap;
  width: calc((var(--hex-width) + var(--hex-gap)) * 4);
  padding: calc(var(--hex-margin-y) * -1) 0;
}

/* =========================================
   3..........完整代码请登录后点击上方下载按钮下载查看

网友评论0