What are some elements you learned?
<img src="selfie.jpg" alt="yours truly">
What is the element? Tag? Attribute? Value?
Nesting is what happens when you put other containing tags inside other containing tags.
<ul>
<li>
<p>A paragraph inside a list item</p>
</li>
</ul>
Incorrect:
<ul>
<li>
<p>A paragraph inside a list item</p>
</ul>
</li>
<p>
<h1>
, <h2>
, ...<em>
& strong <strong>
<a>
<img>
<br>
<ol>
, <ul>
& list item <li>
<table>
, etc.<div>
, span <span>
<!-- -->
What are some attributes you learned?
.main img.polaroid {
border: 1px solid black;
padding: 0.5rem 0.5rem 2rem;
}
What is the selector? What is it selecting? What are the attributes? What are their values?
Inline
Some text.
Embedded
<head>
</head>
Linked
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
color
background-color
font
(and related)position
style
attributeWhat are some block elements?
What are some inline elements?
A collection of production-ready HTML, CSS, JavaScript components that we can use in our designs.
CSS Frameworks - Usually include a reset, a grid system, styles for typography and forms. Some include support for mobile/print.
Javascript Frameworks - Gives structure to your JavaScript code and keeps it organized.
Responsiveness and cross-browser consistency for free.
Modular and reusable components.
Bootstrap is a front-end UI (user interface) framework originally created by Twitter
Speeds up the development of new websites and web applications.
#1 Project on github with over 100k stars and 45k forks
Bootstrap is an open source project on GitHub, meaning anyone can contribute to its progress.
Why reinvent the wheel? - Out of the box styles and components?
Designed to be responsive - HTML elements respond to changes in screen size.
Mobile-first - certain mobile-friendly styles (like the ability to zoom in) are included in the core files
So this desktop design:
Also looks great on a tablet:
And rad on a smartphone!
Bootstrap stylishly fast-tracks your web development. It's an excellent tool to get your project up and running in no time!
You can download all the necessary Bootstrap files from getbootstrap.com or from the Bootstrap repo on GitHub.
Embed the files on your .html page using a link
element
You can also link to it from a content delivery network (CDN)
Options for structuring your pages with Bootstrap, including global styles, required scaffolding, grid system, and more.
Styles for displaying content with some of the most commonly used HTML elements, including normalization, typography, images, tables, and more.
Over a dozen reusable components built to provide buttons, dropdowns, input groups, navigation, alerts, and much more.
Check out some of the components by opening the example.html
file in your browser window.
Check Bootstrap documentation if there's an existing CSS class or style
Create your own separate CSS file (e.g. overrides.css)
Inspect the bootstrap element you want to customize and copy the selector into your overrides CSS file
Make sure to include your file after Bootstrap base CSS
Bootstrap is based on a 12-column grid, and uses CSS classes to decide the width of each element.
Each element can take up between 1-12 columns worth of space...
.container
(fixed-width) or .container-fluid
(full-width) for proper alignment and padding..row
) to create horizontal groups of columns.
[CONTENT FOR ROW]
Open up columns.html
in your browser window.
Resize your browser to see where the columns break to fit 100% of the width.
Open up columns-fluid.html
in your browser window.
Resize your browser to see where the columns break to fit 100% of the width.
If you want to have two 50% columns on a mobile phone, you would use .col-xs-6
nested in a .row
, and the rows would be consistent on every device...
[COLUMN 1 CONTENT]
[COLUMN 2 CONTENT]
Two 50% columns on a mobile phone
If you want to have four 25% columns on a desktop, and would like them to break to 100% on a tablet, you would use .col-md-3
nested in a .row
.
[COLUMN 1 CONTENT]
[COLUMN 2 CONTENT]
[COLUMN 3 CONTENT]
[COLUMN 4 CONTENT]
Four 25% columns on desktop that break to 100% width on a tablet.
[COLUMN 1 CONTENT]
[COLUMN 2 CONTENT]
Bootstrap's base typography classes normalize headings, paragraph fonts, list styles and more.
Textual utility classes are also included for layout
Images in Bootstrap 4 can be made responsive by adding the .img-fluid
class.
Applies max-width: 100%;
and height: auto;
so it scales to fit the parent element.
.img-rounded
applies rounded edges.img-circle
takes a square image and applies the style border-radius: 50%;
.img-thumbnail
applies a border with rounded edges to the image