个人技术分享

  • 首页
  • 关于
  • 主题
  • 影视解析
  • 音乐
  • 归档
  • 留言
个人技术分享
  • 首页
  • 关于
  • 主题
  • 影视解析
  • 音乐
  • 归档
  • 留言
个人技术分享
刷新页面会随机【个人信息流样式】
28文章    103获赞    231评论    7.7万+浏览
世界那么大,我想去看看。但钱包那么小,哪也去不了。所以,珍惜当下,享受生活。
30岁 IP: 杭州 家里蹲大学
  • 首页
  • 关于
  • 主题
  • 影视解析
  • 音乐
  • 归档
  • 留言
hanhanjun888@163.com

个人技术分享

真正的50行css代码实现响应式“瀑布流”布局
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
  <title>瀑布流</title>
  <style>
    :root {--color1: #a3d9a5;--color2: #f6b93b;--color3: #38ada9;--color4: #e55039;--color5: #1e3799;--color6: #6a89cc;--color7: #f8c291;--color8: #b71540;}
    .lists .item:nth-child(odd) {background-color: var(--color1);}
    .lists .item:nth-child(even) {background-color: var(--color2);}
    .lists .item:nth-child(3n) {background-color: var(--color3);}
    .lists .item:nth-child(4n) {background-color: var(--color4);}
    .lists .item:nth-child(5n) {background-color: var(--color5);}
    .lists .item:nth-child(6n) {background-color: var(--color6);}
    .lists .item:nth-child(7n) {background-color: var(--color7);}
    .lists .item:nth-child(8n) {background-color: var(--color8);}

    .lists {width: 1200px;margin: 0 auto;column-count: 4;column-gap: 10px;transition: column-count 0.3s ease-in-out;}
    .lists .item {height: 160px;margin-bottom: 10px;break-inside: avoid;color: #000000;text-align: center;font-size: 30px;transition: height 0.3s ease-in-out;}
    /* 更多的高度和选择器组合 */
    .lists .item:nth-child(3n+1) { height: 200px; }
    .lists .item:nth-child(4n+1) { height: 250px; }
    .lists .item:nth-child(5n+1) { height: 180px; }
    .lists .item:nth-child(6n+1) { height: 280px; }
    .lists .item:nth-child(7n+1) { height: 220px; }
    .lists .item:nth-child(8n+1) { height: 300px; }
    .lists .item:nth-child(9n+1) { height: 230px; }
    .lists .item:nth-child(10n+1) { height: 260px; }
    @media (max-width: 992px) {
      .lists {width: auto;padding: 10px;box-sizing: border-box;column-count: 3;column-gap: 10px;}
      .lists .item {break-inside: avoid;width: auto;text-align: center;margin-bottom: 10px;}
      /* 在较小屏幕下适应不同的高度 */
      .lists .item:nth-child(3n+1) { height: 220px; }
      .lists .item:nth-child(4n+1) { height: 180px; }
      .lists .item:nth-child(5n+1) { height: 250px; }
      .lists .item:nth-child(6n+1) { height: 200px; }
    }
    @media (max-width: 768px) {
      .lists {width: auto;padding: 10px;box-sizing: border-box;column-count: 2;column-gap: 10px;}
      .lists .item {break-inside: avoid;width: auto;height: 200px;line-height: 200px;text-align: center;margin-bottom: 10px;}
      .lists .item:nth-child(2n+1) {height: 240px;}
      .lists .item:nth-child(3n+1) {height: 320px;}
    }
  </style>
</head>
<body>
<div class="lists"><div class="item">1</div><div class="item">2</div><div class="item">3</div><div class="item">4</div><div class="item">5</div><div class="item">6</div><div class="item">7</div><div class="item">8</div><div class="item">9</div><div class="item">10</div><div class="item">11</div><div class="item">12</div><div class="item">13</div><div class="item">14</div><div class="item">15</div><div class="item">16</div>
</div>
</body>
</html>
1年前 1,127浏览 0
赞 评论
评论(0)

暂无数据

取消回复

个人技术分享
刷新页面会随机【个人信息流样式】
28文章    103获赞    231评论    7.7万+浏览
世界那么大,我想去看看。但钱包那么小,哪也去不了。所以,珍惜当下,享受生活。
30岁 IP: 杭州 家里蹲大学
  • 首页
  • 关于
  • 主题
  • 影视解析
  • 音乐
  • 归档
  • 留言
  • fastadmin appendfieldlist 用法1年前
  • wordpress 对数据库的操作 $wpdb2年前
  • Python框架 Flask和Django - 区别1年前
  • 解决移动设备上的所有浏览器顶部都有地址栏,导致高度问题1年前
  • wordpress 主题 hankin 新增登录注册、用户中心2年前

免费开源主题:smarty_hankin v2.0重构版

wordpress版本:6.0+

PHP版本:7.0~8.0

gitee源码仓库地址:点击打开

github源码仓库地址:点击打开

最新源码地址:待更新

加QQ群入口:1018842166

WP开源主题 smarty_hankin

hankin 扫码关注公众号

最近评论


    Warning: Trying to access array offset on value of type null in /www/wwwroot/hankin.cn/wp-content/themes/hankin/inc/widget/widget-comments.php on line 32

    Warning: Trying to access array offset on value of type null in /www/wwwroot/hankin.cn/wp-content/themes/hankin/inc/widget/widget-comments.php on line 32
  • […] 平台主题名称介绍价格地址WPpix综合性最好的主题298DemoWPpink完成度高朋友圈499DemoWPhankin还在完善的主题noDemoTypicefox完成度高FreeDemoTypListen完成度高FreeDemoTypNabo小鸟风格FreeDemoTypzyyo三栏自适应现代时尚FreeDemoTypFlip仿pix主题noDemoTyppengyou单栏主题noDemoTypfriends单栏主题noDemoTyplan tyLAN程序TY版本39DemoHalopixpix授权移植主题169DemoZblogpyq单栏朋友圈noDemoZblogMoments轻社交朋友圈298DemoHugomoments单栏朋友圈noDemo程序lan程序有朋友圈外观99DemoDiscuz! 朋友圈式手机版Discuz!的纯手机版朋友圈98Demo […] 抠脚大汉的摆烂人生 发布于1年前

  • Warning: Trying to access array offset on value of type null in /www/wwwroot/hankin.cn/wp-content/themes/hankin/inc/widget/widget-comments.php on line 32

    Warning: Trying to access array offset on value of type null in /www/wwwroot/hankin.cn/wp-content/themes/hankin/inc/widget/widget-comments.php on line 32
  • […] Demo […] YanZi-朋友圈 发布于1年前
  • 请问一下,同款主题在哪里授权、下载?   发布于1年前
  • 真不错👍 唤( . )醒 发布于2年前
  • 确实挺不错的 断舍离 发布于2年前

扫码加QQ群:1018842166

微信打赏

支付宝打赏

友情链接: coder gzh DIYgod kam mango pix主题 wordpress 大学 wp2 主题喵 主题猫 元气秋刀鱼 创造狮 吾柯 大海看看 守望轩-宁静雅致的小轩馆 腾讯设计导航 若志奕鑫 风信子博客

hankin Powered by WordPress 浙ICP备20002401号-1