当前位置:网站首页>弹性盒子自动换行小Demo
弹性盒子自动换行小Demo
2022-06-28 12:55:00 【HHppGo】
代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>弹性盒子换行</title>
<style> * {
margin: 0; padding: 0; } .box {
/*2. 使用flex布局 让子级水平排列 父级宽度不够 子级自动伸缩 且伸缩永远不会超过父盒子的宽度 子级不会自动换行 */ display: flex; /* 3.需求: 使用Flex布局让子级水平排列,并且父级宽度不够,子级自动换行*/ /* 默认值,不会自动换行 */ /* flex-wrap: nowrap; */ /* 自动换行 */ flex-wrap: wrap; /* 4.当使用flex-wrap 让flex布局可以多行排列时,行与行之间可以设置对齐方式 */ /* 行与行之间无间距,垂直居中 */ /* align-content: center; */ /* 第一行和最后一行在弹性容器的最上面和最下面 */ align-content: space-between; height: 500px; border: 1px solid #000; } .box div {
/* 1.使用浮动让子级水平排列 父级的宽度不够,子级自动换行*/ /* float: left; */ width: 100px; height: 100px; background-color: pink; } </style>
</head>
<body>
<div class="box">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
</div>
</body>
</html>
效果:

边栏推荐
- Digital twin energy system, creating a "perspective" in the low-carbon era
- Online JSON to plaintext tool
- Jerry's wif interferes with Bluetooth [chapter]
- The paging style flex is set to be displayed at the end (even if the number of pages is longer, there will be no line breaks at the end)
- go template with... End traversal usage
- K3s one click installation script
- 华泰证券手机app下载 怎么办理开户最安全
- 深入理解贝叶斯定理
- 2022招商FinTech比赛总结
- Ipetronik data acquisition equipment and softing q-vision software are committed to ADAS test scheme
猜你喜欢

企业源代码保密方案分享

《数字经济全景白皮书》消费金融数字化篇 重磅发布

Understand leveldb write operation

fastposter v2.8.4 发布 电商海报生成器

group_concat学习与配置

4年用户数破亿,孙哥带领波场再创新高

go template with...end遍历用法

几百行代码实现一个 JSON 解析器

The paging style flex is set to be displayed at the end (even if the number of pages is longer, there will be no line breaks at the end)
Siyuan official paid synchronization Guide
随机推荐
Understand leveldb write operation
Finereport installation tutorial
一款自动生成单元测试的 IDEA 插件,开发效率提升 70% 以上!
group_concat学习与配置
Microservice stability guarantee
ASP. NET CORE Study06
Summary of 2022 China Merchants fintech competition
[MySQL from introduction to mastery] [advanced part] (III) creation of MySQL users_ Modification_ Delete and password settings
After failing in the college entrance examination, he entered Harbin Institute of technology, but stayed in the university after graduation to be an "Explorer". Ding Xiao: scientific research is accum
Copying open source for basic software is not advisable. Self reliance is the right way
Mathematical principle derivation of structured light phase shift method + multifrequency heterodyne
newest! Introduction and practical tutorial of point cloud processing based on open3d
ASP.NET CORE Study02
ASP. NET CORE Study04
pytorch模型调参、训练相关内容
In fact, there are a lot of MATLAB learning and use materials (many documents and videos) on the official website of MATLAB
腾讯确认QQ大规模盗号,iPhone14无缘Type-C,第四大运营商5G正式放号,今日更多大新闻在此...
哪一个证券公司最好最安全 怎么办理开户最安全
Scratch travel photo album Electronic Society graphical programming scratch grade examination level 1 true questions and answers analysis June 2022
centos6.5 php+mysql mysql库找不到