freeCodeCamp/guide/chinese/css/css-frameworks/css-framework-bootstrap/index.md

86 lines
3.9 KiB
Markdown
Raw Normal View History

---
title: CSS Framework Bootstrap
localeTitle: CSS Framework Bootstrap
---
# CSS Framework Bootstrap
Bootstrap是最流行的CSS框架用于为Web开发响应式移动优先项目。
## 入门 - 最新版本4.1
这是一个简单的HTML模板其中包含用于Bootstrap库的最新编译和缩小的CSS和Javascript。我们在此示例中使用了CDN但您可以查看[安装Bootstrap的其他方法](https://getbootstrap.com/docs/4.1/getting-started/download/) 。
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Bootstrap</title>
<!--Latest compiled and minified CSS-->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
</head>
<body>
<!-- Add all HTML Code below -->
<!-- Add all HTML Code above -->
<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<!-- popper.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<!-- Latest compiled bootstrap JavaScript -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script>
</body>
</html>
```
## 入门 - Bootstrap 3
Bootstrap 3不是Bootstrap的最新稳定版本但它仍然是使用最广泛的版本。你会在很多模板wordpress主题项目等等中找到它。考虑到这一点很明显知道如何使用它仍然很有用。 不要犹豫,去寻找优秀的[Bootstrap文档](https://getbootstrap.com/docs/3.3/getting-started/) 。
```html
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap 3 CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- 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]-->
</head>
<body>
<!-- Add all HTML Code below -->
<!-- Add all HTML Code above -->
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<!-- IU jQuery for better animations-->
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<!-- compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>
</html>
```
**注意:**其他版本可用可以在Bootstrap网站上找到。
## 学习资源
* 在[这里](https://getbootstrap.com/docs/4.1/getting-started/introduction/)查看官方的Bootstrap 4文档
* 在[这里](https://getbootstrap.com/docs/3.3/getting-started/)查看官方的Bootstrap 3文档。
* [在这里](https://github.com/twbs/bootstrap) Checkout Bootstrap的开源GitHub存储库。
* 在[FreeCodeCamp](https://www.freecodecamp.com/) 我们将Bootstrap作为课程的一部分。