Bootstrap is a powerful front-end library, that gives you the power of quick design and responsive mobile-first site layout. It lays on top of the 12 grid system and it has extensive pre-built components.
If you donāt know much about it, you can check out myĀ articleĀ about V4 and with some simple examples, youāll have a nice foundation.
In this article, Iāll just sweep through what has changed in V5 and talk about their importance. Bootstrap 5 is an alpha release now and we are waiting for the stable version. You can check the issues and pull requests on their GithubĀ repository.
List of Content
- jQuery removal and switching into JavaScript
- Responsive font sizes
- Drop Internet Explorer support and CSS custom properties
- Change of Unit Measurement
- Enhanced grid system
- Class Updates
- New SVG Icon Library
- Utilities API
- Improved Doc
jQuery Removal and Switching into JavaScript
jQueryĀ is a library that offers an abstraction layer for classic web scripting. The extensible nature of it, allows the developer to reach an element in a document without writing a lot of JavaScript. You can modify the elements, respond to a userās interaction, or retrieve some information from a server without refreshing the page with AJAX and the list goes on.
Even though jQuery has incredible helpers, it has lost its popularity nowadays because of its load time and rise of other frameworks/libraries like React, Angular, and Vue. These modern tools use a virtual DOM to interact with the real DOM and this way is much faster than the sites that use old jQuery.
So, for those reasons, Bootstrap left jQuery and start using only Vanilla JavaScript. Now you can use efficient Vanilla JavaScript without worrying about the addition of non-essential functions and the addition of global objects which jQuery adds.
Responsive Font Sizes
Designing a website for different platforms and viewports can be challenging. To overcome this problem developers need to use media queries that allow the page to look different on different viewports.
RFSĀ is a unit resizing engine. It automatically calculates the appropriate font size based on the screen size. It can be used for any CSS property with units. It was in V4 already but now itās enabled by default in V5.
Drop Internet Explorer support and CSS custom properties
In 1995, Microsoft released Internet Explorer and in those days it was a popular browser due to its support for CSS and Java applets. However, nowadays itās already lost its popularity and became a nightmare to designers since it does not support modern JavaScript standards. To use IE you need to compile your JavaScript code into ES5 which increases the size of your project. Even worse, you can not use modern CSS properties and this limits your ability to design your page properly.
In Bootstrap 5, the team decided to drop the support for IE and focus more on new classes and CSS custom properties. This enables the developers to concentrate on more robust design without worrying about old browser support and increased project sizes.
In V4 there were only root variables for colors and fonts. Now the team has added more components and layout options. You can apply the striped, hoverable, and active style much easier, and now they are working on utilizing powers of Sass and CSS for more flexible systems. For more information clickĀ hereĀ and go to CSS Custom Properties.
Change of Unit Measurement
CSS offers different types of unit measurements such as px, rem, em, %, vw, and vh. The px is widely used and known as an absolute measurement. The px measurement does not change with different screen sizes and it is not a suitable choice for responsive web design.
Bootstrap has been using the px measurement for its gutter width and now with V5 it has been changed into rem or āroot emā.
The rem calculates the font size of the root element and arranges the size depending on that root element. (For most browsers it is 16px).
Enhanced Grid System
In V4 we already have a great 12 column grid system. Now it is time to say hello to the āxxlā grid which is for screens more than 1400px wide. Gutter classes have been replaced with āg-*ā utilities much like margin/padding utilities. You can use āgx-*ā or āgy-*ā to have space between your columns and rows. To learn more please lookĀ here. In addition to those, columns are no longer āposition: relativeā by default. To understand more I found thisĀ pull requestĀ to be very helpful.
Class Updates
In V4 there are more than 1,500 CSS classes. Some CSS classes are no longer available in V5 and there are some additions to the classes as well.
Some of the CSS classes removed from Bootstrap are:
- * form-row
- * form-inline
- * list-inline
- * card-deck
- Some CSS classes added to Bootstrap are:
- * g-*, gx-*, gy-*
- * rows-cols-auto
New SVG Icon Library
In Bootstrap 4, there was no library for icons so developers needed to find a free icon provider likeĀ Font AwesomeĀ or use their own custom icons.
In Bootstrap 5, there is a brand new SVG icon library. Before the stable version release, you can use this library and add icons to your project. You can visit thisĀ pageĀ to learn more.
Utilities API
In V4, you can control and customize the page with the global ā$enable-*ā classes, and in V5 itās carried forward with an API based approach. The developers created a language and syntax in Sass for us to create our own utilities. You can even modify or remove utilities with this API based approach. According to their blog site:ā We think this will be a game-changer for those who build on Bootstrap via our source files, and if you havenāt built a Bootstrap-powered project that way yet, your mind will be blownā. This makes me excited because Iāve rarely used Bootstrap source files and now I am thinking of using them more often after seeing the stable release.
Improved Doc
Their documentation static site generator has switched fromĀ Jekyll toĀ Hugo. As their saying, Jekyll requires Ruby to be installed, and site generation was slow, so they decided to change into Hugo.
While the static site generator change is important there is something that is more important. They now have a āCustomize Docā which extends on V4ās Theming page with more content and code snippets for building on top of Bootstrapās source Sass files. They even have aĀ starter npm projectĀ for us to get started easier and faster.
Conclusion
One frustrating issue for web developers is doing some repeated tasks for all of their projects. It can be like reinventing the wheel every time you start a project. Bootstrap can be helpful for these kinds of duties and also just to have great responsive layouts.
Bootstrap 4 is already in use and very suitable for these kinds of tasks. With the update to V5, I believe it will be even more attractive and get more attention from the developer community.
If you want to see all the changes in a list, check them outĀ here. For more information, you can view theirĀ blog. I found thisĀ articleĀ to be very useful and contains information about the changes in Card components and NavBar optimization.
When a stable version is released, hope to write again with more context.
This article was previously behind a paywall: https://medium.com/@sercanuygur/bootstrap-5-what-has-changed-e22a328bfde5