天天看點

Bootstrap學習筆記-2

  1. 一個栅格的例子

    項目結構

  2. Bootstrap學習筆記-2
<%@ page language="java" contentType="text/html; charset=UTF-8"
  pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet"
  href="${pageContext.request.contextPath}/bootstrap3/css/bootstrap.min.css">
<link rel="stylesheet"
  href="${pageContext.request.contextPath}/bootstrap3/css/bootstrap-theme.min.css">
<script
  src="${pageContext.request.contextPath}/bootstrap3/js/jquery-1.11.2.min.js"></script>
<script
  src="${pageContext.request.contextPath}/bootstrap3/js/bootstrap.min.js"></script>
<style type="text/css">
.c1 {
  background-color: #CCFF99;
}

.c2 {
  background-color: #FFCCCC;
}

.c3 {
  background-color: #CCEEFF;
}

.c4 {
  background-color: #E6E6FA;
}
</style>
</head>
<body>
  <div class="container">
    <div class="row">
      <div class="col-md-1 c1">.col-md-1</div>
      <div class="col-md-1 c2">.col-md-1</div>
      <div class="col-md-1 c1">.col-md-1</div>
      <div class="col-md-1 c2">.col-md-1</div>
      <div class="col-md-1 c1">.col-md-1</div>
      <div class="col-md-1 c2">.col-md-1</div>
      <div class="col-md-1 c1">.col-md-1</div>
      <div class="col-md-1 c2">.col-md-1</div>
      <div class="col-md-1 c1">.col-md-1</div>
      <div class="col-md-1 c2">.col-md-1</div>
      <div class="col-md-1 c1">.col-md-1</div>
      <div class="col-md-1 c2">.col-md-1</div>
    </div>
    <div class="row">
      <div class="col-md-8 c3">.col-md-8</div>
      <div class="col-md-4 c4">.col-md-4</div>
    </div>
    <div class="row">
      <div class="col-md-4 c1">.col-md-4</div>
      <div class="col-md-4 c2">.col-md-4</div>
      <div class="col-md-4 c1">.col-md-4</div>
    </div>
    <div class="row">
      <div class="col-md-6 c3">.col-md-6</div>
      <div class="col-md-6 c4">.col-md-6</div>
    </div>
  </div>
</body>
</html>      

通路的URL

Bootstrap學習筆記-2
  • 最外層要一個 <div class=“container”>(開發網站一般用container)
  • 最多12列(可不占滿)
  • 嵌套的子列,每一列12格
  • 每一嵌套格都是行列嵌套
<div class="row">
  <div class="col-md-1">.col-md-1</div>
  ...(最多12列)
</div>