Bootstrap 4 Get Started | bootstrap cdn

What is Bootstrap?

  • Bootstrap is a free front-end framework for doing faster and easier web development 
  • Bootstrap includes HTML and CSS based design templates for typography, forms,tables, buttons,  modals, navigation, image carousels and many other, as well as optional JavaScript plugins
  • Bootstrap also gives you the ability to easily create a responsive design
What is Responsive Web Design?

Responsive web design is about creating a web site which automatically adjusts themselves to look good on all devices, from small phones to large desktops.

Bootstrap 3 vs. Bootstrap 4

Bootstrap 4 is the new version of Bootstrap; with new components, faster stylesheet and more responsiveness.
Bootstrap 4 supports all the latest, stable releases of all major browsers and platforms. However, Internet Explorer 9 and down do not support.
If you require IE8-9 support, use Bootstrap 3. The most stable version of Bootstrap, and it is still supported by the team for critical bug fixes and documentation changes. However, there is no new features will be added to it.
Dropped icon support: Bootstrap 4 does not support BS3 Glyphicons. Use Font-Awesome or other icon libraries instead.

Why Use Bootstrap?

Advantages of Bootstrap:
  • Easy to use: Anybody with just basic knowledge of HTML and CSS who can start using Bootstrap
  • Responsive features: Bootstrap's responsive CSS adjusts to tablets, phones, and desktops
  • Mobile-first approach: In Bootstrap, mobile-first styles are part of the core frameworks
  • Browser compatibility: Bootstrap 4 is compatible with all modern browsers (Firefox, Chrome,  Internet Explorer 10+, Edge, Safari, and Opera)

Where to Get Bootstrap 4?

There are two ways to start using Bootstrap 4 on your own web sites.
You can:
  • Include Bootstrap 4 from a CDN
  • Download Bootstrap 4 from getbootstrap.com


Bootstrap 4 CDN

If you don't want to download and host Bootstrap 4 yourself, you can include it from  CDN (Content Delivery Network).
MaxCDN is provide CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:

MaxCDN:

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet"href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">

<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<!-- Popper JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>

<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
One advantage of using the Bootstrap 4 CDN:
Many users already have to downloaded Bootstrap 4 from MaxCDN when visiting another site. As a result, it will be loaded from cache when they visit your sites, which leads to faster loading time. Most of the CDN's will make sure that once a user requests a file from it, it will be served from the server closest to them, which also leads to faster loading time.

jQuery and Popper?
Bootstrap 4 use jQuery and Popper.js for JavaScript component (like modals, tooltips, popovers etc). However, if you just use the CSS part of the Bootstrap, you don't need them.

Downloading Bootstrap 4

If you want to download and host Bootstrap 4 in yourself, go to https://getbootstrap.com/, and follow the instructions there.

Create First Web Page With Bootstrap 4

1. Add the HTML5 doctype
Bootstrap 4 uses HTML elements and also use CSS properties that require the HTML5 doctype.
Always include the HTML5 doctype at the beginning of your page, along with the lang attribute and the correct character set:
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
  </head>
</html>
2. Bootstrap 4 is mobile-first
Bootstrap 4 is designed to be responsive to all mobile devices. Mobile-first styles are part of the core framework.
To ensure proper rendering and touch zooming, add the following <meta> tag inside the <head> element:
<meta name="viewport" content="width=device-width, initial-scale=1">
The width=device-width part sets the width of the page to follow the screen-width of the devices (which will vary depending on the device).
The initial-scale=1 part sets the initial zoom level when the page is first loaded on the browser.
3. Containers
Bootstrap 4 also requires a containing element to wrap sites contents.
There are two container classes to choose from:
  1. The .container class provide a responsive fixed width container
  2. The .container-fluid class provide  a full width container, spanning the entire width of the viewport

.container
.container-fluid















Two Basic Bootstrap 4 Pages

The following example show the code for a basic Bootstrap 4 page (with a responsive fixed width container):

Container Example

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap 4 Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet"href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h1>My First Bootstrap Page</h1>
  <p>This is some text.</p>
</div>

</body>
</html>
Try it Yourself »
The following examples show the code for a basic Bootstrap 4 page (with a full width container):

Container Fluid Example

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap 4 Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet"href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container-fluid">
  <h1>My First Bootstrap Page</h1>
  <p>This is some text.</p>
</div>

</body>
</html>
Try it Yourself »

No comments:

Post a Comment