More Unicode Patterns

Creating is the most intense excitement one can come to know.

                                               —Anni Albers, On Designing

今天看到一篇博客,反正就是要实现下面的类似效果,反正我之前不知道怎么做。

在这里插入图片描述
其实也不是完全不知道怎么做,就是一个个的div里面放上一个汉字就可以了吧,但是每个div的大小太难配置了,可以说很难解决。不知道这种布局的官方名称是什么,先叫做瓦片布局吧。

博客中是这么做的,就是grid布局。

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <style>
    * {
      padding: 0;
      margin: 0;
      font-family: 黑体;
      box-sizing: border-box;
    }

    section {
      background-color: #09BB07;
      display: grid;
      width: 60vw;
      height: 30vw;
      overflow: hidden;
      grid-template-columns: repeat(60, 1vw);
      grid-template-rows: repeat(30, 1vw);
      grid-auto-flow: column;
      grid-auto-flow: row;
      /*grid-auto-flow: dense;*/
    }

    div {
      display: flex;
      justify-content: center;
      align-items: center;
      --n: 3;
      grid-column-end: span var(--n);
      grid-row-end: span var(--n);
      font-size: calc(var(--n) * 1vw);
      border: 1px solid red;
    }

  </style>
</head>
<body>

<section>
</section>
</body>
<script>
  let fragment=document.createDocumentFragment();
  for(let i=0;i<30;i++){
     fragment.append(document.createElement('div'));
  }
  document.querySelector('section').append(fragment);
  [...document.querySelectorAll('div')].forEach((div, index) => {
    div.style.setProperty('--n', Math.ceil(Math.random() * 10));
    div.innerHTML = String.fromCodePoint(Math.round(Math.random() * 20901) + 19968);
    // div.innerHTML = index;
  });
</script>
</html>

下图是上面代码跑起来的结果,我不断刷新的截屏gif
在这里插入图片描述

参考文献:
https://css-tricks.com/more-unicode-patterns

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Spring 5 Design Patterns is for all Java developers who want to learn Spring for the enterprise application. Therefore, enterprise Java developers will find it particularly useful in the understanding of design patterns used by the Spring Framework and how it solves common design problems in the enterprise application, and they will fully appreciate the examples presented in this book. Before reading this book, readers should have basic knowledge of Core Java, JSP, Servlet, and XML. Spring 5 Framework is newly launched by Pivotal with reactive programming. Spring 5 introduces many new features and enhancements from its previous version. We will discuss all this in the book. Spring 5 Design Patterns will give you in-depth insight about the Spring Framework. The great part of today's Spring Framework is that all companies have already taken it as a primary framework for development of the enterprise application. For Spring, no external enterprise server is needed to start working with it. The goals of writing this book are to discuss all design patterns used behind the Spring Framework and how they are implemented in the Spring Framework. Here, the author has also given you some best practices that must be used in the design and development of the application. The book contains 12 chapters that cover everything from the basics to more complex design pattern such as reactive programming. Spring 5 Design Patterns is divided into three sections. The first section introduces you to the essentials of the design patterns and the Spring Framework. The second section steps behind the front end and shows where Spring fits in the back end of an application. The third section expands on this by showing how to build web applications with Spring and introducing a new feature of the Spring 5 reactive programming. This part also shows how to handle concurrency in the enterprise application.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值