9. 基本程式 ( 含有 glyphicons)
<!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">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->
<link href="css/bootstrap.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
.glyphicon {
font-size: 30px;
}
</style>
</head>
<body>
<h1>Hello, world!</h1>
<div style="height:100px;width:100px;">
<span class="glyphicon glyphicon-envelope"></span>
</div>
<div class="form-group has-success has-feedback">
<label class="control-label" for="inputSuccess2">Input with success</label>
<input type="text" class="form-control" id="inputSuccess2" aria-describedby="inputSuccess2Status">
<span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span>
<span id="inputSuccess2Status" class="sr-only">(success)</span>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.js"></script>
</body>
</html>
13. Grid System Rules
• 為了讓可以對齊與 padding , Rows 必需被放在 .container(fixed-
width 大尺寸下沒填滿畫面 ) 或 .container-fluid(full-width 大尺寸下填
滿畫面 )
• 使用 rows 來建立欄位的水平群組
• 預先定義的類別如 .row 和 .col-sm-4 ,可以快速製作 grid 佈局
• 透過 padding 來建立欄位的排水構。
• 透過 rows 類別的負邊距 (negative margin) 在第一或最後欄位偏移
padding
• Rows must be placed within a .container (fixed-width) or .container-
fluid (full-width) for proper alignment and padding
• Use rows to create horizontal groups of columns
• Content should be placed within columns, and only columns may be
immediate children of rows
• Predefined classes like .row and .col-sm-4 are available for quickly
making grid layouts
• Columns create gutters (gaps between column content) via padding.
That padding is offset in rows for the first and last column via
negative margin on .rows
• Grid columns are created by specifying the number of 12 available
columns you wish to span. For example, three equal columns would
24. 在 div 中的圖片置中
• 給 img style 屬性,並設定
• display: block /*for the img inside your div
*/ margin-left: auto margin-right: auto
• 或
• display: block /*for the img inside your div
*/ margin: 0 auto