Almost everyone has used Bootstrap at least once or twice.
Millions of websites, prototypes and themes for popular content management systems such as WordPress use Bootstrap. It is simple to install, easy to use and saves time. Built on high-quality HTML, CSS and JavaScript, it lets you create attractive designs with little effort.
CSS media queries let websites and applications scale from a single codebase to phones, tablets and laptops. Bootstrap offers easily applied components including modals, galleries, tooltips, collapsible tabs, dropdown menus, buttons and more.
This article describes what is new in Bootstrap 4. Its alpha release is a preview rather than a fully stable version; features may change, so it should not yet be used in production. We will explore the improvements so far to help you understand the new features and prepare future work.
Before introducing Bootstrap 4's features, let's briefly review the recent updates.
A Brief Recent History of Bootstrap
On 19 August 2015, Bootstrap's fourth anniversary, the development team released the first Bootstrap 4 alpha. A key change from Bootstrap 3 was dropping Internet Explorer 8, allowing better use of CSS3 without relying on CSS workarounds or fallbacks.
Further alpha releases followed: alpha 2 on 8 December 2015, alpha 3 on 27 July 2016 and alpha 4 on 19 October 2016. The latest stable version, Bootstrap 3.3.7, was officially released on 25 July 2016.
These updates, with invaluable help from the Bootstrap community, proposed and incorporated hundreds of improvements, bug fixes and documentation updates.
WHAT IS NEW IN BOOTSTRAP 4?
Bootstrap 4 is built on HTML5, CSS3, JavaScript and Sass. In recent years, frontend developers have increasingly preferred Sass over Less. Previous Bootstrap releases used Less as their preprocessor.
A maintained Sass port became available with Bootstrap 3.
Bootstrap 4 now uses Sass by default, with Libsass, a fast C/C++ Sass compiler. To learn more about the choice between Less and Sass and the team's decision to change the codebase, see the opinion article “Why Bootstrap 4 Uses Sass”.
Now let's explore what Bootstrap 4 offers.
Cards in Bootstrap 4 replace panels, thumbnails and wells, using modifier classes to provide similar functions.
A card is a flexible, extensible content container supporting headers, footers, varied content, contextual background colours and powerful display options.
Cards can stand alone or be grouped, with or without equal heights. To show how they replace earlier components, I created the same visual example with a Bootstrap 3 thumbnail and a Bootstrap 4 card.
The Bootstrap 3 code is shown below:
<div class=”thumbnail”>
<img src=”https://placehold.it/350×150″ alt=””>
<div class=”caption”>
<h3>Bootstrap 4</h3>
<p>The new version of Bootstrap is incredible. You should definitely try it!</p>
<a href=”#” class=”btn btn-primary” role=”button”>Download</a>
</div>
</div>
This produces:
How the Bootstrap 3 thumbnail looks
The Bootstrap 4 code is as follows:
<div class=”card”>
<img class=”card-img-top” src=”https://placehold.it/350×150″ alt=””>
<div class=”card-block”>
<h3 class=”card-title”>Bootstrap 4</h3>
<p class=”card-text”>The new version of Bootstrap is incredible. You should definitely try it!</p>
<a href=”#” class=”btn btn-primary” role=”button”>Download</a>
</div>
</div>
The Bootstrap 4 code produces:
How Bootstrap 4 cards look
The markup is almost identical. Cards need a few extra classes because of their flexibility. In Bootstrap 3, the image is centred by default.
New Button Styles
Buttons have a new, flatter style without gradients. The btn-outline-* classes have also been introduced.
The following HTML lets you compare their appearance across versions:
<button type=”button” class=”btn btn-primary”>Primary</button>
<button type=”button” class=”btn btn-outline-primary”>Primary</button>
<button type=”button” class=”btn btn-secondary btn-lg”>Large button</button>
<a href=”#” class=”btn btn-secondary btn-lg active” role=”button” aria-pressed=”true”>Link</a>
<button type=”button” class=”btn btn-lg btn-primary” disabled>Primary button</button>
This is how the buttons look in Bootstrap 3:
Buttons in Bootstrap 3
And the new appearance in Bootstrap 4:
Buttons in Bootstrap 4
Typography Changes
Bootstrap 4's default font size is 16px rather than 14px, making text larger and more visible.
Font sizing and the grid system now rely dynamically on rem units to make scaling on mobile devices easier. Pixels, ems and points can still be used for typography, but Bootstrap 4's font sizing is based on rem.
Bootstrap 4 also drops the Glyphicons icon font. If you need icons, the team recommends:
The upstream version of Glyphicons
Octicons
Font Awesome
The use of rem units also applies to the grid system, including max-width.
DISPLAY HEADINGS
The rem unit supports a new display-heading typography component. Bootstrap 3 already allowed classes such as h1 and h2 to style elements as headings. Bootstrap 4 adds a component for particularly prominent page headings.
Bootstrap 4 supports four display-heading sizes with display-* classes. The example below shows their use:
<h1 class=”display-1″>Heading 1</h1>
<h1 class=”display-2″>Heading 2</h1>
<h1 class=”display-3″>Heading 3</h1>
<h1 class=”display-4″>Heading 4</h1>
This is how they look:
Display headings in Bootstrap 4
FLEXBOX
One major new feature is Flexbox support, providing simpler, more flexible CSS layouts. As the official Bootstrap guide explains, Flexbox offers:
Easy vertical alignment of content within a parent element.
Easy content reordering across devices and screen resolutions using media queries.
Equal-height columns for grid layouts using CSS alone.
These are also possible without Flexbox, but usually require additional workarounds to achieve correctly.
For more detail and the effects of enabling it in Bootstrap grid components, see the article “Using Flexbox in Bootstrap 4”.
OTHER CHANGES
New spacing utility classes improve control of horizontal and vertical spacing. Margins or padding can now be added in any direction with a utility class.
The code is simple:
<div class=”row”>
<div class=”col-sm-6 m-t-md”>
<!– column-small-50%, margin-top-medium –>
</div>
</div>
The notation is intuitive: m means margin and p means padding. Directions are t for top, r for right, l for left, x for left and right, y for top and bottom, and a for all sides. Sizes include 0 for zero, auto, md for medium and lg for large. Leave it empty for the default.
Each plugin has also been rewritten in ES6 to use newer JavaScript features, and the documentation has been updated.
For additional resources, see Nicholas Cerminara's article and Carol Skelly's post on Medium.
What Changed from Bootstrap 3 to Bootstrap 4?
Two changes to existing components stand out. First, the new col-xl-* classes introduce another grid breakpoint. Bootstrap 3's four-tier grid becomes a five-tier grid covering typical portrait and landscape screen widths.
The five tiers are now:
Extra small (<544 px)
Small (≥544 px)
Medium (≥768 px)
Large (≥992 px)
Extra large (≥1200 px)
The XL breakpoint covers screens wider than 1200px, while XS targets screens narrower than 544px, improving support for small devices.
Bootstrap 3's col-xs-* tier covered widths below 768px, while the new tier covers widths below 544px. This improves portrait layouts on smartphones.
Second, Bootstrap 4 adds custom forms that can replace browser defaults. It also adds inverse tables through table-inverse. The CodePen example demonstrates this feature.
This should provide a useful overview of differences between versions 3 and 4. For all details, see the comprehensive list, which will be revised as development continues.
Conclusion
This article gives a quick overview of Bootstrap 4's new features and the transition from version 3. For further details and the latest changes, carefully read the official documentation and the Bootstrap 4 migration guide.
Bootstrap 4's release date is not yet known. Follow the team's progress and the project's GitHub page for more details. Contributions are welcome: the team has ambitious plans and a long to-do list and will appreciate your help.


