Bootstrap 4: Heads Up Aug 2017 - Bootstrap 4 Beta Is Out!
Bootstrap 4: Heads Up Aug 2017 - Bootstrap 4 Beta Is Out!
Bootstrap 4: Heads Up Aug 2017 - Bootstrap 4 Beta Is Out!
Looking back at Bootstrap 3, the 4 grid tiers (‘xs’, ’sm’, ‘md’ and ‘lg’
breakpoints) .
The smallest breakpoint has a wide range of devices less than 768px in
width.
Bootstrap 4 Grid
Breakpoints:
The XL breakpoint is screen widths > 1200px
The LG breakpoint is screen widths > 992px
The MD breakpoint is screen widths > 768px
The SM breakpoint is screen widths > 544px
The XS breakpoint is screen widths < 544px
Utilities
Headings have margin-bottom: .5rem added and paragraphs margin-bottom: 1rem for
easy spacing.
Display Headings**
.list-unstyled removes the default list-style and left margin on list items
(immediate children only). This only applies to immediate children list
items.
Inline: Remove a list’s bullets and apply some light margin with a
combination of two classes, .list-inline and .list-inline-item.
Images
For proper styling, use one of the four required contextual classes (e.g.,
.alert-success).
For inline dismissal, use the alerts jQuery plugin.
Link Color: Use the .alert-link utility class to quickly provide matching
colored links within any alert.
Alerts can also contain additional HTML elements like headings,
paragraphs and dividers.
Alert Dismissing
Cards can include top and bottom “image caps”—images at the top or
bottom of a card. Image overlays
Turn an image into a card background and overlay your card’s text
Cards include various options for customizing their backgrounds, borders,
and color.
Includes a few options for laying out series of cards.
Collapse
Toggle the visibility of content across your project with a few classes and
our JavaScript plugins.
Examples
.collapse hides content
.collapsing is applied during transitions
.collapse.show shows content
You can use a link with the href attribute, or a button with the data-
target attribute. In both cases, the data-toggle="collapse" is required.
Multiple targets
Multiple <button> or <a> can show and hide an element if they each reference
it with their ‘href’ or ‘data-target’ attribute
Collapse with JavaScript Methods
.collapse(options)
.collapse('toggle') - Returns to the caller before the collapsible element
has actually been shown or hidden
.collapse('show') - Returns to the caller before the collapsible element
has actually been shown
.collapse('hide') - Returns to the caller before the collapsible element
has actually been hidden
Collapse with JavaScript Events
hide.bs.collapse This event is fired immediately when the hide method has
been called.
hidden.bs.collapse This event is fired when a collapse element has been
hidden from the user (will wait for CSS transitions to
complete).
$('#myCollapsible').on('hidden.bs.collapse', function () {
// do something…
})
Forms
Renamed .control-label to .form-control-label.
Renamed .input-lg and .input-sm to .form-control-lg and .form-control-sm, respectively.
Dropped .form-group-* classes for simplicity’s sake. Use .form-control-* classes instead
now.
Dropped .help-block and replaced it with .form-text for block-level help text. For inline
help text and other flexible options, use utility classes like .text-muted.
Horizontal forms overhauled:
Dropped the .form-horizontal class requirement.
.form-group no longer applies styles from the .row, so .row is now required for horizontal
grid layouts (e.g., <div class="form-group row">).
Added new .form-control-label class to vertically center labels with .form-controls.
Added custom forms support (for checkboxes, radios, selects, and file inputs).
Jumbotron
To make the jumbotron full width, and without rounded corners, add the
.jumbotron-fluid modifier class and add a .container or .container-fluid
within.
Navs - Alignments
Via JavaScript
$('#myTab a').click(function (e) {
e.preventDefault()
$(this).tab('show')
})
Activate individual tabs in several ways
When showing a new tab, the events fire in the following order:
Place various form controls and components within a navbar with .form-
inline.
Navbars may contain bits of text with the help of .navbar-text. This class
adjusts vertical alignment and horizontal spacing for strings of text.
Theming the navbar has never been easier thanks to the combination of
theming classes and background-color utilities.
Navbar Responsive behaviour
With a brand name shown on the left and toggler on the right:
Popover
Popovers rely on the 3rd party library Popper.js for positioning. You must
include popper.min.js before bootstrap.js in order for popovers to work!
Popovers require the tooltip plugin as a dependency.
Specify container: 'body' to avoid rendering problems in more complex
components (like our input groups, button groups, etc).
Triggering popovers on hidden elements will not work.
Popovers for .disabled or disabled elements must be triggered on a
wrapper element.
Popover Everywhere
Use the focus trigger to dismiss popovers on the next click that the user
makes.
Scrollspy also works with nested .navs. If a nested .nav is .active, its parents
will also be .active.
Scroll the area next to the navbar and watch the active class change.
Scrollspy also works with .list-groups. Scroll the area next to the list group
and watch the active class change.
Nested Nav List-group
Scrollspy - Using JavaScript
After adding position: relative; in your CSS, call the scrollspy via JavaScript:
Events
Align items
Use align-items utilities on flexbox containers to change the alignment of
flex items on the cross axis (the y-axis to start, x-axis if flex-direction:
column). Choose from start, end, center, baseline, or stretch (browser
default).
Align Self
Use align-self utilities on flexbox items to individually change their
alignment on the cross axis
Flex - Auto margins
With justify-content
move all flex items to one side, but keep another on the opposite end
by mixing justify-content with margin-right: auto or margin-left: auto.
With align-items
move one flex item to the top or bottom of a container by mixing
align-items, flex-direction: column, and margin-top: auto or margin-
bottom: auto.
Flex - Wrap
Flex - Align content
Toggle floats on any element, across any breakpoint, using our responsive float
utilities.
Text
Text transform
<p class="text-lowercase">Lowercased text.</p>
<p class="text-uppercase">Uppercased text.</p>
<p class="text-capitalize">CapiTaliZed text.</p>
Font weight and italics
<p class="font-weight-bold">Bold text.</p>
<p class="font-weight-normal">Normal weight text.</p>
<p class="font-italic">Italic text.</p>