diff options
author | Mark Otto <markd.otto@gmail.com> | 2022-04-21 08:27:28 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-21 08:27:28 +0300 |
commit | fc87624a5002177eb590101a087e0c03a68f73c0 (patch) | |
tree | 7c93f820db30bd2eeecbcf0975e9a93d480ee8eb /site/content/docs | |
parent | 1dc59b0d4e9ea5dd1a07aa91f964b491de1310ba (diff) |
Rewrite Getting Started > Introduction page to be more guide-like (#36204)
* Rewrite Getting Started > Introduction page to be more guide-like
* Add tabs, mention offcanvas for navbar
Diffstat (limited to 'site/content/docs')
-rw-r--r-- | site/content/docs/5.1/getting-started/introduction.md | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/site/content/docs/5.1/getting-started/introduction.md b/site/content/docs/5.1/getting-started/introduction.md index e12ea9687e..70bfdc7046 100644 --- a/site/content/docs/5.1/getting-started/introduction.md +++ b/site/content/docs/5.1/getting-started/introduction.md @@ -1,7 +1,7 @@ --- layout: docs -title: Introduction -description: Get started with Bootstrap via CDN and a template starter page. +title: Get started with Bootstrap +description: Bootstrap is a powerful, feature-packed frontend toolkit. Build anything—from prototype to production—in minutes. group: getting-started aliases: - "/docs/5.1/getting-started/" @@ -12,42 +12,77 @@ toc: true ## Quick start -Looking to quickly add Bootstrap to your project? Use jsDelivr, a free open source CDN. Using a package manager or need to download the source files? [Head to the downloads page]({{< docsref "/getting-started/download" >}}). +Get started by including Bootstrap's production-ready CSS and JavaScript via CDN without the need for any build steps. See it in practice with this [Bootstrap CodePen demo](https://codepen.io/team/bootstrap/pen/qBamdLj). -### CSS +<br> -Copy-paste the stylesheet `<link>` into your `<head>` before all other stylesheets to load our CSS. +1. **Create a new `index.html` file in your project root.** Include the `<meta name="viewport>` tag as well for [proper responsive behavior](https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag) in mobile devices. -```html -<link href="{{< param "cdn.css" >}}" rel="stylesheet" integrity="{{< param "cdn.css_hash" >}}" crossorigin="anonymous"> -``` + ```html + <!doctype html> + <html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>Bootstrap demo</title> + </head> + <body> + <h1>Hello, world!</h1> + </body> + </html> + ``` -### JS +2. **Include Bootstrap's CSS and JS.** Place the `<link>` tag in the `<head>` for our CSS, and the `<script>` tag for our JavaScript bundle (including Popper for positioning dropdowns, poppers, and tooltips) before the closing `</body>`. Learn more about our [CDN links](#cdn-links). -Many of our components require the use of JavaScript to function. Specifically, they require our own JavaScript plugins and [Popper](https://popper.js.org/). Place **one of the following `<script>`s** near the end of your pages, right before the closing `</body>` tag, to enable them. + ```html + <!doctype html> + <html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>Bootstrap demo</title> + <link href="{{< param "cdn.css" >}}" rel="stylesheet" integrity="{{< param "cdn.css_hash" >}}" crossorigin="anonymous"> + </head> + <body> + <h1>Hello, world!</h1> + <script src="{{< param "cdn.js_bundle" >}}" integrity="{{< param "cdn.js_bundle_hash" >}}" crossorigin="anonymous"></script> + </body> + </html> + ``` -#### Bundle + You can also include [Popper](https://popper.js.org/) and our JS separately. If you don't plan to use dropdowns, popovers, or tooltips, save some kilobytes by not including Popper. -Include every Bootstrap JavaScript plugin and dependency with one of our two bundles. Both `bootstrap.bundle.js` and `bootstrap.bundle.min.js` include [Popper](https://popper.js.org/) for our tooltips and popovers. For more information about what's included in Bootstrap, please see our [contents]({{< docsref "/getting-started/contents#precompiled-bootstrap" >}}) section. + ```html + <script src="{{< param "cdn.popper" >}}" integrity="{{< param "cdn.popper_hash" >}}" crossorigin="anonymous"></script> + <script src="{{< param "cdn.js" >}}" integrity="{{< param "cdn.js_hash" >}}" crossorigin="anonymous"></script> + ``` -```html -<script src="{{< param "cdn.js_bundle" >}}" integrity="{{< param "cdn.js_bundle_hash" >}}" crossorigin="anonymous"></script> -``` +3. **Hello, world!** Open the page in your browser of choice to see your Bootstrapped page. Now you can start building with Bootstrap by creating your own [layout]({{< docsref "/layout/grid" >}}), adding dozens of [components]({{< docsref "/components/buttons" >}}), and utilizing [our official examples]({{< docsref "/examples" >}}). -#### Separate +## CDN links -If you decide to go with the separate scripts solution, Popper must come first (if you're using tooltips or popovers), and then our JavaScript plugins. +As reference, here are our primary CDN links. -```html -<script src="{{< param "cdn.popper" >}}" integrity="{{< param "cdn.popper_hash" >}}" crossorigin="anonymous"></script> -<script src="{{< param "cdn.js" >}}" integrity="{{< param "cdn.js_hash" >}}" crossorigin="anonymous"></script> -``` +{{< bs-table >}} +| Description | URL | +| --- | --- | +| CSS | `{{< param "cdn.css" >}}` | +| JS | `{{< param "cdn.js_bundle" >}}` | +{{< /bs-table >}} + +You can also use the CDN to fetch any of our [additional builds listed in the Contents page]({{< docsref "/getting-started/contents" >}}). + +## Next steps + +- Read a bit more about some [important global environment settings](#important-globals) that Bootstrap utilizes. + +- Read about what's included in Bootstrap in our [contents section]({{< docsref "/getting-started/contents#precompiled-bootstrap" >}}) and the list of [components that require JavaScript](#js-components) below. -#### Modules +- Need a little more power? Consider building with Bootstrap by [including the source files via package manager]({{< docsref "/getting-started/download#package-managers" >}}). -If you use `<script type="module">`, please refer to our [using Bootstrap as a module]({{< docsref "/getting-started/javascript#using-bootstrap-as-a-module" >}}) section. +- Looking to use Bootstrap as a module with `<script type="module">`? Please refer to our [using Bootstrap as a module]({{< docsref "/getting-started/javascript#using-bootstrap-as-a-module" >}}) section. -#### Components +## JS components Curious which components explicitly require our JavaScript and Popper? Click the show components link below. If you're at all unsure about the general page structure, keep reading for an example page template. @@ -60,7 +95,8 @@ Curious which components explicitly require our JavaScript and Popper? Click the - Collapse for toggling visibility of content - Dropdowns for displaying and positioning (also requires [Popper](https://popper.js.org/)) - Modals for displaying, positioning, and scroll behavior -- Navbar for extending our Collapse plugin to implement responsive behavior +- Navbar for extending our Collapse and Offcanvas plugins to implement responsive behaviors +- Navs with the Tab plugin for toggling content panes - Offcanvases for displaying, positioning, and scroll behavior - Scrollspy for scroll behavior and navigation updates - Toasts for displaying and dismissing @@ -68,49 +104,13 @@ Curious which components explicitly require our JavaScript and Popper? Click the {{< /markdown >}} </details> -## Starter template - -Be sure to have your pages set up with the latest design and development standards. That means using an HTML5 doctype and including a viewport meta tag for proper responsive behaviors. Put it all together and your pages should look like this: - -```html -<!doctype html> -<html lang="en"> - <head> - <!-- Required meta tags --> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - - <!-- Bootstrap CSS --> - <link href="{{< param "cdn.css" >}}" rel="stylesheet" integrity="{{< param "cdn.css_hash" >}}" crossorigin="anonymous"> - - <title>Hello, world!</title> - </head> - <body> - <h1>Hello, world!</h1> - - <!-- Optional JavaScript; choose one of the two! --> - - <!-- Option 1: Bootstrap Bundle with Popper --> - <script src="{{< param "cdn.js_bundle" >}}" integrity="{{< param "cdn.js_bundle_hash" >}}" crossorigin="anonymous"></script> - - <!-- Option 2: Separate Popper and Bootstrap JS --> - <!-- - <script src="{{< param "cdn.popper" >}}" integrity="{{< param "cdn.popper_hash" >}}" crossorigin="anonymous"></script> - <script src="{{< param "cdn.js" >}}" integrity="{{< param "cdn.js_hash" >}}" crossorigin="anonymous"></script> - --> - </body> -</html> -``` - -For next steps, visit the [Layout docs]({{< docsref "/layout/grid" >}}) or [our official examples]({{< docsref "/examples" >}}) to start laying out your site's content and components. - ## Important globals -Bootstrap employs a handful of important global styles and settings that you'll need to be aware of when using it, all of which are almost exclusively geared towards the *normalization* of cross browser styles. Let's dive in. +Bootstrap employs a handful of important global styles and settings, all of which are almost exclusively geared towards the *normalization* of cross browser styles. Let's dive in. ### HTML5 doctype -Bootstrap requires the use of the HTML5 doctype. Without it, you'll see some funky incomplete styling, but including it shouldn't cause any considerable hiccups. +Bootstrap requires the use of the HTML5 doctype. Without it, you'll see some funky and incomplete styling. ```html <!doctype html> @@ -121,13 +121,13 @@ Bootstrap requires the use of the HTML5 doctype. Without it, you'll see some fun ### Responsive meta tag -Bootstrap is developed *mobile first*, a strategy in which we optimize code for mobile devices first and then scale up components as necessary using CSS media queries. To ensure proper rendering and touch zooming for all devices, **add the responsive viewport meta tag** to your `<head>`. +Bootstrap is developed *mobile first*, a strategy in which we optimize code for mobile devices first and then scale up components as necessary using CSS media queries. To ensure proper rendering and touch zooming for all devices, add the responsive viewport meta tag to your `<head>`. ```html <meta name="viewport" content="width=device-width, initial-scale=1"> ``` -You can see an example of this in action in the [starter template](#starter-template). +You can see an example of this in action in the [quick start](#quick-start). ### Box-sizing |