Home >Web Front-end >Bootstrap Tutorial >How to introduce bootstrap
There are two main ways to introduce Bootstrap: CDN: Import files from CDN by adding link tags and JavaScript tags. Local files: Download and extract Bootstrap into your project folder, then reference the local files via link tags and JavaScript tags.
How to introduce Bootstrap
Bootstrap is a popular and easy-to-use CSS framework for creating responsive website. It provides a variety of predefined styles, components, and layouts that simplify the web development process.
Methods to introduce Bootstrap
There are two main methods to introduce Bootstrap:
1. CDN (Content Delivery Network)
<link>
tags in the HTML file: <code class="html"><link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"></code>
<script>
tag is added to the bottom of the page to introduce JavaScript files: <code class="html"><script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script></code>
2. Local file
<link>
tags to the HTML file: <code class="html"><link href="css/bootstrap.min.css" rel="stylesheet"></code>
<code class="html"><script src="js/bootstrap.min.js"></script></code>
Which method to choose
The CDN method is simpler as it does not require downloading any files. If you don't want to maintain a local copy of your Bootstrap files, a CDN is a good option.
The local file method provides better performance because the file is stored locally rather than loaded from a remote server. If you have a custom Bootstrap theme or plan to make modifications to the framework, the local files approach is better for you.
The above is the detailed content of How to introduce bootstrap. For more information, please follow other related articles on the PHP Chinese website!