Tim Carlson
I'm a lecturer at University of Washington
Objective: Use HTML & CSS to design a static version of your app
Requirements:
They are relative sizes calculated
Thing B = 50 x .5 = 25px
Thing C = 40 x 1 = 40px
Index.html
style.css
- How much commenting should we do in the code?
- How many lines of code should phase 1 include?
- Can we use bootstrap?
- Do I have to implement the topic I chose from the proposal?
- When to use class vs ids vs tags
<head>
<!--... other elements here...-->
<!-- link Bootstrap -->
<!-- CSS only -->
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css">
<!-- link own stylesheets AFTER framework -->
<link rel="stylesheet" href="css/my-style.css">
</head>
minified CSS file!
<head>
<!-- link Bootstrap -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
rel="stylesheet">
<!-- link own stylesheets AFTER framework -->
<link rel="stylesheet" href="css/my-style.css">
</head>
Before
After
Bootstrap provides rules that apply to particular classes. Give an element that class in order to style it in a certain way.
margin top of 0
margin side of 1
padding on x and y of 2
padding of 3
Levels of size range from 0 to 5
Buttons, Cards, Carousel, Dropdowns, Navbar, Spinners, etc...
Button example
Example:
Syntax
The media queries effect screen widths with the given breakpoint or larger.
We tend to write the responsive utility classes left to right:
<div class =d-none d-sm-block d-md-none">
Within the HTML brackets '<' '>' the order doesn't matter. Bootstrap has the media query ordered in the CSS file smallest to largest.
Make sure to put link your stylesheet further down in the html file than bootstrap to override bootstrap classes
row
row
column
column
column
There are 12 columns in the grid
Elements can take up many columns
Row 1:
Row 2:
Row 3:
Specify columns based on screen-size
Smaller screen display
A Row:
Text
The Bootstrap framework provides some interactive "widgets" you can use without writing separate JavaScript code, just by using specific HTML attributes.
<button class="btn btn-primary"
data-bs-toggle="collapse"
data-bs-target="#collapseExample"
aria-expanded="false" aria-controls="collapseExample">
Button with data-bs-target
</button>
<div class="collapse" id="collapseExample">
Some placeholder content for the collapse component. This panel is
hidden by default but revealed when the user clicks the toggler.
</div>
As a simple example, you can make an element "collapsable" so that it disappears with a button click!
<button class="btn btn-primary"
data-bs-toggle="collapse"
data-bs-target="#collapseExample"
aria-expanded="false" aria-controls="collapseExample">
Button with data-bs-target
</button>
<div class="collapse" id="collapseExample">
Some placeholder content for the collapse component. This panel is
hidden by default but revealed when the user clicks the toggler.
</div>
As a simple example, you can make an element "collapsable" so that it disappears with a button click!
<button class="btn btn-primary"
data-bs-toggle="collapse"
data-bs-target="#collapseExample"
aria-expanded="false" aria-controls="collapseExample">
Button with data-bs-target
</button>
<div class="collapse" id="collapseExample">
Some placeholder content for the collapse component. This panel is
hidden by default but revealed when the user clicks the toggler.
</div>
As a simple example, you can make an element "collapsable" so that it disappears with a button click!
<button class="btn btn-primary"
data-bs-toggle="collapse"
data-bs-target="#collapseExample"
aria-expanded="false" aria-controls="collapseExample">
Button with data-bs-target
</button>
<div class="collapse" id="collapseExample">
Some placeholder content for the collapse component. This panel is
hidden by default but revealed when the user clicks the toggler.
</div>
As a simple example, you can make an element "collapsable" so that it disappears with a button click!
<button class="btn btn-primary"
data-bs-toggle="collapse"
data-bs-target="#collapseExample"
aria-expanded="false" aria-controls="collapseExample">
Button with data-bs-target
</button>
<div class="collapse" id="collapseExample">
Some placeholder content for the collapse component. This panel is
hidden by default but revealed when the user clicks the toggler.
</div>
As a simple example, you can make an element "collapsable" so that it disappears with a button click!
aria for screen-readers
See https://getbootstrap.com/docs/5.1/components/
navbar/#toggler for an example of a NavBar with a collapsible "hamburger menu"
Read: through Chapter 10
Now is a good time to catch up
Problem Set 04 due Wednesday
Start thinking about project appearance/design
Will work with that in lab next week
Next: JavaScript
By Tim Carlson