What's new in Bootstrap 4 ?
Tuesday, July 4, 2017
Table of Contents
Bootstrap 4 is just round the corner. Bootstrap 4 is a major rewrite of the entire project. Here is list of major changes in latest version of Bootstrap.
Browser support
- Bootstrap 4 doesn’t support IE8, IE9, and iOS 6 support. v4 is now only IE10+ and iOS 7+.
- Official support for Android v5.0 Lollipop’s Browser and WebView.
Global changes
- Flexbox is enabled by default. In general this means a move away from floats and more across our components.
- Switched from Less to Sass for source CSS files.
- Switched from
px
torem
- Global font-size increased from
14px
to16px
. - Revamped grid tiers to add a fifth option (addressing smaller devices at
576px
and below) and removed the-xs
infix from those classes. Example:.col-6.col-sm-4.col-md-3
. - Replaced the separate optional theme with configurable options via SCSS variables (e.g.,
$enable-gradients: true
). - Bootstrap 4 doesn’t support non-responsive websites.
- Bunch of new utility classes for common CSS property-value pairs and margin/padding spacing shortcuts.
Grid system
- Moved to flexbox. Bootstrap 4 is now flexbox by default! Flexbox is an immensely powerful layout tool, providing unparalleled flexibility and control to our grid system and core components.
- Added support for flexbox in the grid mixins and predefined classes.
- As part of flexbox, included support for vertical and horizontal alignment classes.
- Updated grid class names and a new grid tier.
- Added a new
sm
grid tier below768px
for more granular control. In latest version of bootstrap you can usexs
,sm
,md
,lg
, andxl
. This also means every tier has been bumped up one level (so.col-md-6
in v3 is now.col-lg-6
in v4). xs
grid classes have been modified to not require the infix to more accurately represent that they start applying styles atmin-width: 0
and not a set pixel value. Instead of.col-xs-6
, it’s now.col-6
. All other grid tiers require the infix (e.g.,sm
).- Updated grid sizes, mixins, and variables.
- Grid gutters now have a Sass map so you can specify specific gutter widths at each breakpoint.
- Updated grid mixins to utilize a
make-col-ready
prep mixin and amake-col
to set theflex
andmax-width
for individual column sizing. - Changed grid system media query breakpoints and container widths to account for new grid tier and ensure columns are evenly divisible by
12
at their max width. - Grid breakpoints and container widths are now handled via Sass maps (
$grid-breakpoints
and$container-max-widths
) instead of a handful of separate variables. These replace the@screen-*
variables entirely and allow you to fully customize the grid tiers. - Media queries have also changed. Instead of repeating our media query declarations with the same value each time, we now have
@include media-breakpoint-up/down/only
. Now, instead of writing@media (min-width: @screen-sm-min) { ... }
, you can write@include media-breakpoint-up(sm) { ... }
.
Components
- Dropped following components:
- Panels
- Thumbnails
- Wells
- Instead of them you can use all-encompassing component Cards
- Dropped the Glyphicons icon font. But no worries our bootstrap admin templates are delivered with some great icon sets:
- Dropped the pager component.
- Refactored nearly all components to use more un-nested class selectors instead of over-specific children selectors.
- Updated navbar. The navbar has been entirely rewritten in flexbox with improved support for alignment, responsiveness, and customization.
- Responsive navbar behaviors are now applied to the
.navbar
class via the required.navbar-expand-{breakpoint}
where you choose where to collapse the navbar. Previously this was a Less variable modification and required recompiling. .navbar-default
is now.navbar-light
, though.navbar-dark
remains the same. One of these is required on each navbar. However, these classes no longer setbackground-color
s; instead they essentially only affectcolor
.- Navbars now require a background declaration of some kind. Choose from our background utilities (
.bg-*
) or set your own with the light/inverse classes above for mad customization. - Given flexbox styles, navbars can now use flexbox utilities for easy alignment options.
.navbar-toggle
is now.navbar-toggler
and has different styles and inner markup (no more three<span>
s).- Dropped the
.navbar-form
class entirely. It’s no longer necessary; instead, just use.form-inline
and apply margin utilities as necessary. - Navbars no longer include
margin-bottom
orborder-radius
by default. Use utilities as necessary. - All examples featuring navbars have been updated to include new markup.