1. 程式人生 > >Bootstrap3基礎 clearfix pull-left/right 輔助類樣式 快速左右浮動

Bootstrap3基礎 clearfix pull-left/right 輔助類樣式 快速左右浮動

true set tle height title info ray ref class

禮悟:
   公恒學思合行悟,尊師重道存感恩。葉見尋根三返一,江河湖海同一體。
虛懷若谷良心主,願行無悔給最苦。讀書鍛煉養身心,誠勸且行且珍惜。


   ide:visual studio 2017  
browser:Firefox / Chrome
  bootstrap:3.3.7

代碼

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <!-- 頁面的寬度與設備屏幕的寬度一致 -->
	<meta name="viewport" content="width=device-width">
	<!-- 初始縮放比例 1:1,沒有橫線滾動的效果 -->
	<meta name="viewport" content="initial-scale=1">
	<!-- 禁止用戶縮放 -->
	<meta name="viewport" content="user-scalable=no">

    <!-- 引入外部bootstrap的css文件(壓縮版) -->
	<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
	<!-- NO.1 先引入jQuery文件(壓縮版) -->
	<script src="bootstrap/js/jquery.min.js"></script>
	<!-- NO.2 再引入js文件(壓縮版) -->
	<script src="bootstrap/js/bootstrap.min.js"></script>

    <style>
        div.top{
            margin:0px auto;
            background-color:gray;
            width:600px;
        }

        div.pull-left {
            background-color:aquamarine;
            width:200px;
            height:260px;
        }

        div.pull-right {
            background-color:coral;
            width:300px;
            height:260px;
        }
    </style>
</head>
<body>
    <div class="container">
        <!-- 
            clearfix:清除浮動 
            給父div塊加的,恢復其自然高度 
            -->
        <div class="top clearfix">
            <div class="pull-left">
                左浮動
            </div>
            <div class="pull-right">
                右浮動
            </div>
        </div>
    </div>
</body>
</html>

效果

技術分享圖片


Bootstrap,優秀的前端開源框架,值得學習。
學習資源:v3.bootcss.com + itcast和itheima視頻庫 + 清凈的心地。如果您有公開的資源,可以分享給我的話,用您的資源學習也可以。
博文是觀看視頻後,融入思考寫成的。博文好,是老師講得好。博文壞,是 給最苦 沒認真。

Bootstrap3基礎 clearfix pull-left/right 輔助類樣式 快速左右浮動