网格布局实现拖动容器自动填充元素效果

代码语言:html

所属分类:布局界面

代码描述:网格布局实现拖动容器自动填充元素效果

代码标签: 拖动 容器 自动 填充 元素 效果

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


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

<style>
* {
  user-select: none;
}

body {
  margin: 0;
  font-family: sans-serif;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(to bottom, #425, #768);
  color: #fff;
}

.wrapper {
  border: 2px solid #000;
  box-sizing: border-box;
  display: grid;
  height: 50vmin;
  width: 50vmin;
  resize: vertical;
  overflow: hidden;
  grid-template-columns: 1fr;
  grid-template-rows: repeat(auto-fill, minmax(50px, 1fr));
  grid-auto-rows: 0;
}
h1 { font-size: max(16px, 4vmin); }

.child {
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  font-size.........完整代码请登录后点击上方下载按钮下载查看

网友评论0