阡陌 发表于 2023-12-19 01:34:35

Web 前端框架 Bootstrap



## 简介

Bootstrap 是由 Twitter 设计师 Mark Otto 和 Jacob Thornton 合作开发的 Web 前端开发框架。它提供了很多前端开发中常用的 CSS 和 Javascript 功能。这使得在前端开发中不需要再那么在意 div 等 HTML 元素的宽度、高度等细节,使得开发过程变更加轻而易举。Bootstrap 的响应式栅格系统和 Mobile First 的设计思想,使得页面可以很好地适应于各种流行的屏幕尺寸。

## 文件结构

```
bootstrap/
├── css/
│   ├── bootstrap.css
│   ├── bootstrap.css.map
│   ├── bootstrap.min.css
│   ├── bootstrap-theme.css
│   ├── bootstrap-theme.css.map
│   └── bootstrap-theme.min.css
├── js/
│   ├── bootstrap.js
│   └── bootstrap.min.js
└── fonts/
    ├── glyphicons-halflings-regular.eot
    ├── glyphicons-halflings-regular.svg
    ├── glyphicons-halflings-regular.ttf
    ├── glyphicons-halflings-regular.woff
    └── glyphicons-halflings-regular.woff2

```

css 文件夹:

bootstrap*.css 是 Bootstrap 的核心 CSS 文件;

bootstrap-theme*.css 是一个可选的Bootstrap主题文件,可以根据需要来引用。

Javascript 插件依赖于 jQuery 库,所以使用的时候注意要引用相应的 jQuery 文件。

Bootstrap 使用了 glyphicons.com 提供的矢量 Web 字体替代了传统的图片格式图标,可以像使用文字一样灵活地使用图标。

## 基本模板

使用 Bootstrap 时可以仿照下面的模板来创建一个页面:

```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    <link href="css/bootstrap.min.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:// -->
    <!-->
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <!-->
</head>
<body>
    <h1>你好,世界!</h1>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
</body>
</html>
```

## 参考资料

Bootstrap 起步:<http://v3.bootcss.com/getting-started/>


页: [1]
查看完整版本: Web 前端框架 Bootstrap