首页 > 其他分享 >前端学习-UI框架学习-Bootstrap5-003-网格系统

前端学习-UI框架学习-Bootstrap5-003-网格系统

时间:2024-03-28 11:55:05浏览次数:18  
标签:md 创建 网格 003 UI offset Bootstrap5 div col

菜鸟教程链接
Bootstrap 提供了一套响应式、移动设备优先的流式网格系统,随着屏幕或视口(viewport)尺寸的增加,系统会自动分为最多 12 列

规则

  • 网格每一行需要放在设置了 .container (固定宽度) 或 .container-fluid (全屏宽度) 类的容器中,这样就可以自动设置一些外边距与内边距。
  • 使用行来创建水平的列组
  • 内容需要放置在列中,并且只有列可以是行的直接子节点
  • 列通过填充创建列内容之间的间隙。 这个间隙是通过 .rows 类上的负边距设置第一行和最后一列的偏移。
  • 网格列是通过跨越指定的 12 个列来创建。 例如,设置三个相等的列,需要使用三个 .col-sm-4 来设置。
  • Bootstrap 5 和 Bootstrap 4 使用 flexbox(弹性盒子) 而不是浮动。 Flexbox 的一大优势是,没有指定宽度的网格列将自动设置为等宽与等高列

基本结构

<template>
  <div class="container-fluid mt-3">
    <h1>创建列 使用col-*-*的形式</h1>
    <p>创建三个列! 尝试在 class="row" 的 div 中添加新的 class="col" div,会显示四个列。</p>
    <div class="row">
      <div class="col-sm-6 p-3 bg-primary text-white">.col</div>
      <div class="col-sm-3 p-3 bg-success text-white">.col</div>
      <div class="col-lg-3 p-3 bg-dark text-white">.col</div>
      <div class="col-*-4 p-3 bg-info text-white">.col</div>
    </div>
  </div>
  <div class="container-fluid mt-3">
    <h1>创建列 使用col自适应的形式</h1>
    <p>创建三个列! 尝试在 class="row" 的 div 中添加新的 class="col" div,会显示四个等宽的列。</p>
    <div class="row">
      <div class="col p-3 bg-primary text-white">.col</div>
      <div class="col p-3 bg-success text-white">.col</div>
      <div class="col p-3 bg-dark text-white">.col</div>
      <div class="col p-3 bg-info text-white">.col</div>
    </div>
  </div>
</template>

不同的端下显示不同

<div class="container-fluid">
  <div class="row">
    <div class="col-sm-3 col-md-6 bg-success text-white">
      <p>RUNOOB</p>
    </div>
    <div class="col-sm-9 col-md-6 bg-info text-white">
      <p>菜鸟教程</p>
    </div>
  </div>
</div>

嵌套列

<template>
  <div class="container-fluid wrapper">
    <div class="row">
      <div class="col-8 bg-primary p-4">
        .col-8
        <div class="row">
          <div class="col-6 bg-secondary p-2">.col-6</div>
          <div class="col-6 bg-light p-2">.col-6</div>
        </div>
      </div>
      <div class="col-4 bg-success p-4">.col-4</div>
    </div>
  </div>
</template>

偏移列

偏移列通过 offset-- 类来设置。第一个星号( * )可以是 sm、md、lg、xl,表示屏幕设备类型,第二个星号( * )可以是 1 到 11 的数字。

<template>
  <div class="container-fluid wrapper">
    <div class="row">
      <div class="col-xl-4 bg-black text-white">.col-md-4</div>
      <div class="col-xl-4 offset-md-4 bg-success">.col-md-4 .offset-md-4</div>
    </div>
    <div class="row">
      <div class="col-md-3 offset-md-3">.col-md-3 .offset-md-3</div>
      <div class="col-md-3 offset-md-3">.col-md-3 .offset-md-3</div>
    </div>
    <div class="row">
      <div class="col-md-6 offset-md-3">.col-md-6 .offset-md-3</div>
    </div>
  </div>
</template>

标签:md,创建,网格,003,UI,offset,Bootstrap5,div,col
From: https://www.cnblogs.com/ayubene/p/18099491

相关文章

  • Ant Design 设置必填属性的一个坑!Objects are not valid as a React child (found: ob
    1、刚开始,我是用第一种方式。通过一个变量,来设置必填属性的提示值 显示是没有问题的。但是点击ModalForm确认按钮时,报错ObjectsarenotvalidasaReactchild(found:objectwithkeys{requiredMsg}).Ifyoumeanttorenderacollectionofchildren,useanarray......
  • 软件测试技术分享丨uiautomator2详细使用方法
    本文转自测试人社区,原文链接:https://ceshiren.com/t/topic/53961.简介uiautomator2是一个自动化测试开源工具,仅支持android平台的自动化测试,其封装了谷歌自带的uiautomator2测试框架,可以运行在支持Python的任一系统上,目前版本为2.10.2开源库地址:https://github.com/ope......
  • 解决element-ui el-select数据过大方案
    一、背景项目中需要用到el-select选择医院,全国医院数据量非常大,通过API读取数据页面直接卡死。 二、解决方案1、组件:el-select+vue虚拟滚动(vue-virtual-scroll-list)2、安装:npminstallvue-virtual-scroll-list--save3、参考:NPM地址:https://www.npmjs.com/pack......
  • 推荐一个kafka可视化客户端GUI工具(Kafka King)
    KafkaKing,比较新,只需要填写kafka连接地址就行,不需要什么zookeeper。支持的功能也多:查看集群节点列表(完成)创建主题(支持批量)、删除主题、支持根据消费者组统计每个topic的消息积压量(完成)支持查看topic的分区的详细信息,并为主题添加额外的分区(完成)支持查看每个分区的消息offse......
  • 2003 年考研英语真题 - 阅读 1 解析
    2003 年考研英语真题 - 阅读 1 解析WildBillDonovanwouldhavelovedtheInternet.[1]        翻译:WildBillDonovan 应该会喜欢互联网。TheAmericanspymasterwhobuilttheOfficeofStrategicServicesintheWorldWarⅡandlaterlaidtheroo......
  • 2003 年考研英语真题 - 阅读 4 解析
    2003 年考研英语真题 - 阅读 4 解析ItissaidthatinEnglanddeathispressing,inCanadainevitableandinCaliforniaoptional.[1] 翻译:据说,在英国,死亡是迫在眉睫的;在加拿大,死亡是不可避免的;而在加利福尼亚,死亡是可以选择的。1.Itissaidthat 据说。2.i......
  • 2003 年考研英语真题 - 翻译题解析
    2003 年考研英语真题 - 翻译题解析Humanbeingsinalltimesandplacesthinkabouttheirworldandwonderattheirplaceinit.[1]             翻译:各时期各地区的人们都思考各自的世界并想知道自己在其中的位置。1.Humanbeing 人;人类。2.inal......
  • 2003 年考研英语真题 - 阅读 3 解析
    2003年考研英语真题-阅读3解析Inrecentyears,railroadshavebeencombiningwitheachother,mergingintosupersystems,causingheightenedconcernsaboutmonopoly.[1]         翻译:近年来,铁路公司一直在相互合并以便形成超级集团,这引起了人们对垄断......
  • 2003 年考研英语真题 - 完型填空解析
    2003 年考研英语真题- 完型填空解析Teachersneedtobeawareoftheemotional,intellectual,andphysicalchangesthatyoungadultsexperience.[1]      翻译:教师应该了解青少年要经历的情感、智力和身体上的变换。1.beawareof 知道;了解;意识到。2.tha......
  • Android开发-Android APP实操-1.项目创建及启动页面UI编码
    一、项目创建及模拟器安装1.选择新建一个project2. 选择空模板3.完成新project的设置 下载完成后点击Finish4.下载安卓模拟器 选择Pixel7点击下载R 为虚拟机命名,选择竖屏,点击Finish.5.点击启动,测试运行 运行成功! 二、启动页面UI编码 1.打开Main......