Bootstrap 4 Flashcards
What is Bootstrap?
Front-end library/framework
Benefits
Adaptive UI display for various kinds of screens
Catalog of pre-styled elements
Installation Process
- Download the Bootstrap files to local and link to the local in HTML
Though this can cause low performance, as the browser will not recognize the file, and will download it.
Method is not recommended - Include the individual Bootstrap reference link
- Include the Start Template from Bootstrap, which also includes Popper.js and Jquery
Design
Wireframe
Low fidelity black and white sketch, often done using pencil, to highlight the main aspects of a web page
Mockup
High fidelity UI draft of what the final web page can look like.
Prototype
An interactive UI
Navigation Bar
Similar to a div, but more clear for readability Navbar Nav-brand Margin ml-auto As much margin is used to push the item all the way to the right Toggler - Dropdown Menu Colors
Grid Layout System
Consists of 12 columns Can further specify by indicating col-# Further specify by screen size Large - lg Desktops/Laptops Medium - md Small desktops/laptops Ex. col-md-6 Take up 6 units for medium sizes and upward Small - sm Tablets Extra small - xs Phones
Containers
Basic building block of the bootstrap grid system All grid elements are contained inside of a container element class=”container” Responsive to screen size By default, contains margins class=”container-fluid” Adaptive to the width of the screen. Takes up 100% width of the screen
Buttons
Check Bootstrap documentation
Carousel
Can adjust time
Can put transition styles
Cards
Container, that usually consists of an image and text enclosed in a box
Z-Index & Stacking Order
Natural stacking order
The first html elements will be placed towards the back.
Following html elements will be stacked on top of the previous
Z-Index
Default z-index of html elements is 0
z-index of greater than 0 will be placed on top
z-index of less than 0 will be placed towards the back
Doesn’t work for position:static
Media Query Breakpoints
Mobile-First
More people go on websites on their phones than on their desktops
Google ranks searches based on mobile-friendly-ness
@media { … }
Works like a True/False statement. If true, run the code
print
screen
speech
Example:
@media screen (min-width: 900px) { … }
Code should only be activated if the media is a screen with a min-width of 900px
Can also combine multiple features
@media screen (min-width: 900px) and (max-width: 1500px) { … }
Different types of views
Device
Size of the device, fixed
Browser Size
Viewport
Size of the screen that your website is being displayed on
Code Refactoring
- Readability
- Modularity
- Efficiency
- Length
Combining Selectors
Multiple Selectors
selector1, selector2, selector# { … }
Styling is applied to all selectors in the list separated by commas
Hierarchical Selectors
selector1 selector2 { … }
selector1 is the parent, selector2 is the child
Styling is performed on the child element
Note: This is not really used for id selectors, as that is redundant
Combined Selectors (Non-hierarchical)
selector1.selector2{ … }
OR
selector#selector2{ … }
Selector Priority
Selector which is more specific gets higher priority Element Selector Class Selector Try to only have one class for a html element, even though Bootstrap doesn’t follow this ID Selector Use ID sparingly ID has the highest selector priority Avoid inline styling