最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

詳解Bootstrap網(wǎng)格垂直和水平對齊方式

 更新時間:2021年07月06日 09:58:39   作者:俺老劉  
網(wǎng)格在網(wǎng)頁布局中是一個重點和難點,布局是網(wǎng)頁設(shè)計的起點和基礎(chǔ),本文主要介紹了Bootstrap網(wǎng)格垂直和水平對齊方式,感興趣的可以了解一下

1、Bootstrap網(wǎng)格布局

上一節(jié)我們介紹了Bootstrap中的網(wǎng)格,網(wǎng)格在網(wǎng)頁布局中是一個重點和難點,布局是網(wǎng)頁設(shè)計的起點和基礎(chǔ),一定要花功夫弄懂,最起碼把我寫的教程介紹的內(nèi)容弄懂,因為我寫的都是最常用的和最基礎(chǔ)的。當(dāng)然對于一個有一定基礎(chǔ)的網(wǎng)頁設(shè)計師,這些內(nèi)容相信一看就懂,今天我們進一步學(xué)習(xí)網(wǎng)格布局。

本節(jié)內(nèi)容涉及到通用類的彈性盒子(Flex)中的部分功能。

2、垂直對齊

2.1 row標簽中設(shè)置垂直對齊

通過在row標簽中 添加align-items-start、align-items-center、align-items-end可以更改行在容器中的垂直對齊方式,以上三個標簽分別為頂部對齊、居中對齊、底部對齊。以下是一段演示代碼和效果圖,代碼中css代碼設(shè)置背景色和間距,方便查看效果。

<!doctype html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link href="bootstrap5/bootstrap.min.css" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="stylesheet">
    <style>
      .row{background-color: rgba(0, 0, 255, 0.178);height: 260px;margin:30px;}
      .col{background-color: rgba(101, 101, 161, 0.842);height: 80px;padding: 30px;margin: 10px;}
    </style>
    <title>垂直對齊演示</title>
  </head>
  <body>
        <div class="container">

          <div class="row align-items-start">
            <div class="col"> </div>
            <div class="col"></div>
            <div class="col"></div>
          </div>

          <div class="row align-items-center">
            <div class="col"> </div>
            <div class="col"></div>
            <div class="col"></div>
          </div>

          <div class="row align-items-end">
            <div class="col"> </div>
            <div class="col"></div>
            <div class="col"></div>
          </div>

        </div>
   
     <script src="bootstrap5/bootstrap.bundle.min.js" ></script>
  </body>
</html>

2.2 col標簽中設(shè)置垂直對齊

通過在col標簽中 添加align-self-start、align-self-center、align-self-end可以更改列在行中的垂直對齊方式,以上三個標簽分別為頂部對齊、居中對齊、底部對齊。以下是一段演示代碼和效果圖,代碼中css代碼設(shè)置背景色和間距,方便查看效果。

<!doctype html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link href="bootstrap5/bootstrap.min.css" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="stylesheet">
    <style>
      .row{background-color: rgba(0, 0, 255, 0.178);height: 260px;margin:30px;}
      .col{background-color: rgba(101, 101, 161, 0.842);height: 80px;padding: 30px;margin: 10px;}
    </style>
    <title>垂直對齊演示</title>
  </head>
  <body>
        <div class="container">

          <div class="row align-items-start">
            <div class="col  align-self-start"> </div>
            <div class="col align-self-center"></div>
            <div class="col align-self-end"></div>
          </div>

        </div>
   
     <script src="bootstrap5/bootstrap.bundle.min.js" ></script>
  </body>
</html>

3、水平對齊

3.1 row標簽中設(shè)置垂直對齊

通過在row標簽中 添加justify-content-start、justify-content-center、justify-content-end、justify-content-around、justify-content-between、justify-content-evenly可以更改列在行中的水平對齊方式。以下是一段演示代碼和效果圖,代碼中css代碼設(shè)置背景色和間距,方便查看效果。

<!doctype html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link href="bootstrap5/bootstrap.min.css" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="stylesheet">
    <style>
     .row{background-color: rgba(0, 0, 255, 0.178);height: 120px;margin:10px;}
      .col-4{background-color: rgba(101, 101, 161, 0.842);height: 30px;padding: 10px;margin: 10px;}
    </style>
    <title>垂直對齊演示</title>
  </head>
  <body>
        <div class="container">

          <div class="row justify-content-start">
            <div class="col-4"> </div>
            <div class="col-4"></div>
            <div class="col-4"></div>
          </div>

          <div class="row justify-content-center">
            <div class="col-4"> </div>
            <div class="col-4"></div>
            <div class="col-4"></div>
          </div>

          <div class="row justify-content-end">
            <div class="col-4"> </div>
## <div class="col-4"></div>
            <div class="col-4"></div>
          </div>

          <div class="row justify-content-around">
            <div class="col-4"> </div>
            <div class="col-4"></div>
            <div class="col-4"></div>
          </div>

          <div class="row justify-content-between">
            <div class="col-4"> </div>
            <div class="col-4"></div>
            <div class="col-4"></div>
          </div>

          <div class="row justify-content-evenly">
            <div class="col-4"> </div>
            <div class="col-4"></div>
            <div class="col-4"></div>
          </div>
        </div>

到此這篇關(guān)于詳解Bootstrap網(wǎng)格垂直和水平對齊方式的文章就介紹到這了,更多相關(guān)Bootstrap網(wǎng)格垂直和水平對齊方式內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論

锡林浩特市| 醴陵市| 罗田县| 田林县| 合水县| 汝南县| 杂多县| 万年县| 南陵县| 德庆县| 辛集市| 伊春市| 砀山县| 无锡市| 依兰县| 辛集市| 醴陵市| 来宾市| 克东县| 屏边| 龙胜| 富裕县| 香港 | 湖南省| 聊城市| 临澧县| 江阴市| 鹿泉市| 桂林市| 神池县| 彝良县| 徐州市| 阳东县| 北辰区| 四川省| 东丰县| 神农架林区| 抚州市| 玉门市| 从江县| 闻喜县|