Are you a front end developer who is tired of rewriting CSS syntax over and over? That's a great reason to start using Bootstrap! This article will explain what Bootstrap is and cover the benefits of using a web framework, as well as how to properly embed it in your project.
What is Bootstrap?
You are probably already familiar with what frameworks do. It brings together task-specific syntaxes in one collection to help web developers build websites much faster, since they don't have to worry about basic commands and functions.
However, there is still a lack of consistency due to the fact that the libraries are used too much, and need to be changed constantly. Bootstrap is the answer to this problem.
The front-end framework is open source, originally built by Mark Otto and Jacob Thornton to make front-end web programming faster and easier.
It contains all HTML and CSS based design templates with various functions and components, like navigation, grid system, image carousel and buttons.
Although Bootstrap saves developers time from having to manage templates again and again, its main goal is to create responsive websites. It allows the user interface of the website to work optimally on any screen size, on small screen phones or large screen desktops.
As a result, developers no longer need to build device-specific and limited-scope websites.
Due to its popularity, more and more Bootstrap communities appeared. It's a great place for developers and designers to exchange knowledge and discuss the latest framework patches.
3 main files of Bootstrap
Because Bootstrap includes a set of syntaxes that perform specific functions, which only makes sense if the framework has different file types in it. Here are the three main files that manage the user interface and functionality of the website.
Bootstrap.css
Bootstrap.css is a CSS framework that organizes and manages website layouts. While HTML manages the content and structure of the web page, CSS handles the layout of the web page. For that reason, both constructs need to coexist to perform a particular action.
Due to its functionalities, CSS allows you to create a uniform look and feel on as many web pages as you want. Now you can say goodbye to hours of manual editing just to change the width of the border.
With CSS, all you need to do is refer web pages to the CSS file. Any necessary changes can be made in that file alone.
CSS functions are not limited to text styles as they can be used to format other aspects of a web page such as tables and image layouts.
Since CSS has so many declarations and selectors, memorizing all of them can take some time.
Bootstrap.js
This file is the core of Bootstrap. It includes the JavaScript files responsible for the interaction of the web page.
To save time when writing JavaScript syntax multiple times, developers tend to use jQuery. It has a popular open source, cross-platform JavaScript library that allows you to add various functionalities to a website.
Here are a few examples of what jQuery can do:
- Make Ajax requests such as retrieving data from another location dynamically
- Create Widgets Using a Collection of JavaScript Plugins
- Create custom animations using CSS properties
- Add dynamic features to website content
Although Bootstrap with CSS properties and HTML elements can work fine, it needs jQuery to create responsive design. Otherwise you can just use the static parts of the CSS.
Need more information? Check out this article to know more about jQuery.
Glyphicons
Icons are an integral part of the website interface. They are usually associated with certain actions and data in the user interface. Bootstrap uses Glyphicons to fill that need.
Bootstrap includes a set of Halflings Glyphicons unlocked for free to use. The free version has a standard interface but is adequate for essential functions.
If you want to find icons with more style, Glyphicons also sell different premium icon sets, which are sure to look better on a particular site.
You can also download separate and themed icons for free on various websites like Flaticon, GlyphSearch and Icons8.
Some icons can be affected by CSS to change the look while others are default. Use the icons that best suit the site you need.
How to use Bootstrap
To understand how to use bootstrap, see the example below.
html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Bootstrap 101 Template</title>
<link href="https://www.hostinger.vn/huong-dan/css/bootstrap.min.css" rel="stylesheet" />
</head>
<body>
<h1>Hello, world!</h1>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>
Character encoding for HTML documents. In this case, UTF-8 refers to Unicode.
meta charset="utf-8"
Indicates the character set used to write the web page.
meta http-equiv="X-UA-Compatible"
Specifies the version of Internet Explorer to display the page. Use Edge mode, it is set to use the highest mode available.
meta name="viewport"
Make sure the page has a 1:1 ratio to the viewport size.
link href="https://www.hostinger.vn/huong-dan/css/bootstrap.min.css" rel="stylesheet"
This is the part where we add Bootstrap core CSS.
src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"
Load jQuery via Google CDN. It would be better for you to download it from a CDN over HTTP because the file can be cached for a year.
src="https://www.hostinger.vn/huong-dan/js/bootstrap.min.js
Add Bootstrap core JavaScript. This syntax should always be below the jQuery syntax for it to work properly. The addition process can be done through the URL of Google or download it manually.
Conclude
Bootstrap is a free front-end framework that is getting more and more popular among front-end developers. Developers can easily use it and save a lot of time by not having to write code manually.
The framework is also very flexible and can cover almost any front end web development need. Its best capabilities include, but are not limited to, optimized web responsiveness on all screen sizes.
If you are a front end developer, you need to know what Bootstrap is and this is the perfect time for you to start using Bootstrap.
Post a Comment
Post a Comment