Sample Bootstrap 4 Quick Start
Sample Bootstrap 4 Quick Start
Sample Bootstrap 4 Quick Start
Quick Start
1.2:v4.0.0-beta.2
I would like to thank the following for their advice and support
with this project: Greg Vance, Dan Joseph, Chris of D.A., Max,
and my Parents. Marcus and Joshua thank you for your patience as your
Dad was working on this project. Also my mentors for their wisdom and
inspiration: Zig Ziglar, Dan Miller, Seth Godin, and Matthew 25:14-30.
1. Introduction
2. The Mobile Web and Bootstrap
3. Whats New in Bootstrap 4
4. The Design Process
5. Build a Homepage: Prototype | Design
6. Build a CMS Dashboard: Prototype | Design
7. Code Challenge
8. Conclusion & Certification Exam Instructions
9. Appendix
linkedin
PREREQUISITES
Multi-touch gestures overcoming low rates of user adoption. Also, any links
Slower data connections to outside pages required them to open in a web
browser window.
Distracted user attention (one eyeball and
one thumb).
Adaptive Design
At the start, the concept of responsive design did not Another approach is to build multiple versions of a
exist. And so mobile devices had to scale down websites website and use server side detection to then present
to fit the smaller screens. For the user, in order to read custom code for that device or viewport size.
the text they would have to double tap the screen or
pinch and zoom. You could decide to have your mobile site on a separate
domain for example m.domain.com. The server will then
Website owners quickly realized it was not a good automatically serve all mobile traffic to that domain.
experience to display their homepage at a zoomed in
level. The meta tag below was introduced to remove this The server could also perform dynamic serving of page
default scaling and give the site creator more control. content so that you have just one domain name.
Bootstrap was created by Mark Otto and Jacob Thornton A Toolkit Built in Style Guide Form
at Twitter as a framework to encourage consistency
When Bootstrap was first created at Twitter it was built
across internal tools. It is now an open source project
as a toolkit of reusable components with additional
hosted on GitHub and has seen rapid growth and global
documentation and code snippets on how to use
use in web applications and websites.
them. This helped a team of multiple developers work
on a project and have a cohesive methodology on
At this point, you might be wondering what is a Mark Otto wrote on his blog, "Each class name begins
component and why does Bootstrap use them? with a prefix. Class name prefixing makes our code more
durable and easier to maintain, but it also better enables
Well, one definition I found was, "A component is a
us to scope styles to only the relevant elements."
minimal software item that can be tested in isolation."
The keyword in that phrase is isolation.
Being an open source project, anyone can submit Gather a room full of the smartest web designers and
browser bugs and code fixes for it. This is an extremely developers and let them discuss at length what they think
valuable asset to a developer because you gain is the best way to write CSS and to organize a project.
confidence knowing your code has been improved by a The result being a distilled version of best practices
community to address common browser bugs. No matter agreed upon by a large collection of your peers.
how good you are, there is no way you can be aware of
every browser inconsistency and the fix necessary. Helps You Avoid jQuery Plugin Soup
I know some JavaScript but writing a full-fledged plugin
Helps You Follow Best Practices is out of my reach. So I often collected various jQuery
I studied graphic design in college and self-taught plugins into a project to achieve the look and functionality
myself HTML & CSS from books, YouTube, and blog I was looking for.
posts. This mixture of knowlege worked to some degree
but I know there are a lot of knowledge gaps. I hit my But I often ran into the following problems:
lack of understanding head-on when I first learned 1. Plugins would not work across browsers
Bootstrap with all of the new terminology written for 2. Plugin CSS styles would conflict with other
software engineers. CSS styles
3. Plugins would be dependent on different
Bootstrap is not just a versions of jQuery
methodology of best
that you know are stable on modern browsers compatible
and works with your jQuery version. Also, the styling
practices for front-end design. matches all of the other components in the your project.
Summary
When your time is billable, every minute you shave off
will greatly improve your bottom line. Plus it makes
development more fun because you are not declaring
redundant CSS properties.
Bootstrap 3
Aug. 2013 I hope I have shown you how Bootstrap can save you
time and make you a better developer in the process.
In addition, you will be following industry best practices
vetted by an open source community.
The most important element of any CSS If you have no analytics to work with I suggest looking
framework is the grid system. The Bootstrap at StatCounter to see the top browsers in your country.
But from my experience, it is best to have a clear
grid has been used on many websites
understanding of your ideal site visitor. Because there are
worldwide which make it extremely stable. a lot of factors, tools like StatCounter do not factor in.
This cross-browser support is why you One of those being corporate environments that are slow
probably are considering using Bootstrap for to upgrade to newer browsers.
your website (it was for me).
One way to get a clear picture of your target site visitor
In this section, I will provide an overview of the grid is through surveys or live interviews. Talk to likely site
and provide examples to help you quickly apply it to visitors and ask them what browsers they use and if
your projects. there are any IT restrictions preventing them to
upgrade browsers.
Important Once you have your data and some assumptions follow
Before you begin a project, you should know what set of the decision chart below (Fig. 7) to determine what
web browsers you are going to support. This will actually Bootstrap version you should use.
determine what version of Bootstrap you use because
Bootstrap 4 is not supported on IE9 and below. Bootstrap Version Decision Chart
What Versions of Internet Explorer Do You Need I need to support IE10+ Use Bootstrap 4
to Support?
I need to support IE9+
So how do you know what browsers to support? If you Use Bootstrap 3
are redesigning an existing site, I suggest looking at your I need to support IE8+
Google Analytics to see what browser the majority of your
site visitors use. Look for trends to determine if it makes
sense to remove support for an older browser.
12 Column Grid
So now that you understand flexbox and why it's superior
to floats for layout, lets look at how Bootstrap uses this Fig. 11: In this example, I changed the column class to
.col-sm-1 instead of .col which restricts the column
for their grid system.
width even after it has been wrapped. Columns widths are
equally distributed to fill the width of the container. Since
The Bootstrap grid system is based on a 12 column grid
Bootstrap uses a 12 column grid, it breaks after 12 and the
because the number 12 is divisible by 12, 6, 4, 3, 2. So remaining columns are equally distributed.
your column sizes inside each row will need to equal 12.
This math makes the grid more flexible for a wide range
of layouts.
The Bootstrap Grid System Has
Common Grid Layout Examples: Three Main Parts: CRC
2 column grid When working with the Bootstrap 12 column grid you
.col-sm-6 + .col-sm-6 = 12 have to keep in mind the order of elements and that
2 column golden ratio grid there are always three parts: a Container, a Row, and any
.col-sm-8 + .col-sm-4 = 12 number of Columns.
3 column grid
Tip: You can remember CRC by thinking
.col-sm-4 + .col-sm-4 + .col-sm-4 = 12
of a Cabin, a Room inside the cabin,
and finally Chairs inside the room.
Fig. 10: By default, Flexbox item widths are equally If you want all of your page content to be constrained
distributed to fill the width of the container. If you set the to a max-width, you would just need one .container
column class to .col it makes each column horizontal at on your entire page. Or if you would like your columns
all breakpoints. So it doesn't respect the 12 column grid like to fill the entire window and have no max-width use
you think it would as shown in this example. .container-fluid. Then use a series of row blocks
with column divs to build your grid. If your design has no
Row
.row
The way I achieve this effect is using a section tag with a A horizontal wrapping container for the series of columns
background color set to it. it contains.
If you are familiar with a HTML table structure the grid A column is a vertical division similar to a table cell. This
system is very similar. is where your content goes and has built-in margin to the
left and right to prevent text and images from touching
For example:
each other.
table > tr > td Columns also have grid tiers which tell the columns how
is like they should look at different breakpoints. In the example
.container > .row > .col-sm-6 below I used .col-sm-6 which essentially says, When
the browser window is 576px or higher make this column
span 6 of the 12 columns. For anything below 576px
make it full width.
Key points
Small
sm 576px
landscape Uses a 12 column grid and the number of columns
mobile has to equal 12
CRC .container > .row > .col-*-*
Medium
md 768px portrait tablets Most projects will just need one .container unless you
navbar collapse want to do colored row banding
Setting a grid tier like .col-sm-6 says for sm and up
Large Columns have horizontal padding to create the
lg 992px
landscape gutters between individual columns, however, you
tablets can remove the margin from rows and padding from
columns with .no-gutters on the .row.
Extra large Grid columns without a set width will automatically
xl 1200px laptops, layout with equal widths.
desktops, TVs
View documentation
Before we start using Bootstrap I want you doctor flipped lenses and asked me questions like
to be familiar with the design process I follow "Can you see better with these lenses? How about now?
Better or worse?" With each lens flip, my vision would
for most projects. This four phase process
get clearer and clearer. The design process acts in a
has milestones that require approval by the very similar way in bringing more clarity to the project
decision maker before moving onto the next you are building.
phase. These approvals help to eliminate
costly re-work at later stages, delayed Starting out with a blank sheet of paper can be daunting.
But by asking a series of questions before you start your
projects, and stress.
design, you can begin to bring clarity to the final solution.
For example, changing a navigation item name in the
design phase could break the layout and require time to
re-write styles to accommodate.
Research is the gathering of
facts. In the absence of facts,
you have assumptions.
And assumptions are the
enemy of design.
Mike Monteiro
The last time I was at the eye doctor I was fitted for
glasses. As I was looking through one of these, my
Below are the four phases of the design process: These checkpoints or milestones help decrease the
strategy, prototype, design, and delivery. As you progress chances of late changes causing project delays and
through the phases you gain more clarity on the final increased costs.
design solution. Each phase requires client sign-off
before moving on.
1. 2. 3. 4.
Strategy Prototype Design Delivery
Interviews and research You will define the site Work through branding Publish final site and
to define a clear brand architecture, page and visual style. The collect analytics for three
strategy and design naming, and site content client should approve months. Report back
strategy to achieve to be presented. code and not flat and review performance.
business objectives. Photoshop files.
#0275d8 #292b2c Lato Bold BootstrapCreative provides. The high quality design
will demonstrate competency and the ability to achieve
Helvetica Neue Regular
quality work.
Helvetica Neue Medium
Helvetica Neue Bold
#636c72 #e2e2e2
Fixed-top Navbar
Carousel
Services
C
Badge Pill
A. Navbar
E
Now that we have a wireframe, B. Carousel
the next step is to select existing
D
Bootstrap components that we can
use in our project. C. Cards
G. Nav
G F
Step 1
Download the starter project .zip which contains the
folder structure, images, and blank files. Save and unzip
the folder where you would like to keep your website
projects. I personally use XAMPP to run a local server
and generally save all of my web projects in my htdocs
folder that way I can test my projects at localhost/project-
name. If you have never setup a local server before,
you can follow my tutorial to learn the steps.
Step 5 Step 7
For our homepage layout, we want some content to Next, copy the image cards code and paste it to replace
be fluid width and some content to be constrained to the image cards comment section.
the breakpoints. To achieve this we will be using the
.container class on a per section basis instead of
Copy Code bootstrapcreative.com/b4hp07
having all of our body content inside of it.
Step 6 Step 9
Next, copy the carousel code and paste to replace the Next, copy the quote code and paste to replace the
carousel comment section and replace this line of code quote comment section.
<h1>Hello World!</h1>.
Step 12
Next, copy the services code and paste to replace the
services comment section.
Step 13
Next, copy the brand message code and paste to replace
Your screen should now look like this. the brand message comment section.
Great job. You now have a working homepage using In the next section, we will write some custom CSS styles
Bootstrap 4. We used Bootstrap's default styles to get a and add some scripts to make everything look the way
working prototype to quickly demonstrate functionality. we want. See you there.
The prototype gets the basic idea down but it needs
some refinements.
Where to Start Once you have a sketch you like you can then move to
a design program like Photoshop, Adobe XD, or Sketch.
If we refer back to the design process on page 30, we are
These apps will help you work out aesthetics, colors,
now in the design phase. In this phase, we will explore
typography, spacing, and graphics before writing any
design options and then begin to build a polished design
code. Some designers skip this step and go right to code
that we can use for testing and approval.
and design in the browser. I personally think this limits
your creativity especially if you use Bootstrap. The UI of
Design Exploration - Fast Forward
Bootstrap should not influence your design. Following
Now that you have an approved wireframe, architecture, this progression will greatly reduce the chances of your
and page content you can begin exploring different visual site looking too much like a Bootstrap site.
solutions. Every designer has their own method but I
recommend sketching with paper and pencil first. Since design is such a broad topic and would require a
lot of explanation I am going to skip past this process
and move right to development.
Clickable Design
Before responsive design, it was much easier to convert
a desktop design and convert it to code because
everything was fixed width and not much would change.
A. Navbar Branding
Add blue border to the bottom and change link color C
Badge Pill
B. Carousel Captions
Move the captions to the top
D
C. Image Cards
Adjust image widths
E
D. Vertical Centered Content
Make the text vertically centered with the image
H. Nested Columns
Add columns with breakpoints that make sense
Great job. You now have a polished homepage using In the next section, we will follow the same workflow to
Bootstrap 4. We pushed our prototype of default build our CMS dashboard for this site.
Bootstrap components to match our desired design.
And More!
Buy Now