Chapter07 AdvancedCSSLayout
Chapter07 AdvancedCSSLayout
Layout
Chapter 7
Constructing
3 Floating
Elements 4 Multicolumn
Layouts
5 Approaches to
CSS Layouts 6 Responsive
Design
Filters,
7 8
CSS Frameworks
Transitions, and and Preprocessors
Animations
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Chapter 7
1 Normal Flow
2 Positioning
Elements
Constructing
3 Floating
Elements 4 Multicolumn
Layouts
5 Approaches to
CSS Layouts 6 Responsive
Design
Filters,
7 8
CSS Frameworks
Transitions, and and Preprocessors
Animations
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Normal Flow
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Normal Flow
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Normal Flow
Block-Level Elements
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Normal Flow
Inline Elements
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Normal Flow
Block and Inline Elements
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Chapter 7
1 Normal Flow
2 Positioning
Elements
Constructing
3 Floating
Elements 4 Multicolumn
Layouts
5 Approaches to
CSS Layouts 6 Responsive
Design
Filters,
7 8
CSS Frameworks
Transitions, and and Preprocessors
Animations
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Positioning Elements
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Positioning Elements
Relative Positioning
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Positioning Elements
Absolute Positioning
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Positioning Elements
Absolute Positioning is relative to nearest positioned ancestor
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Positioning Elements
Z-Index
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Positioning Elements
Z-Index
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Positioning Elements
Fixed Position
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Chapter 7
1 Normal Flow
2 Positioning
Elements
Constructing
3 Floating
Elements 4 Multicolumn
Layouts
5 Approaches to
CSS Layouts 6 Responsive
Design
Filters,
7 8
CSS Frameworks
Transitions, and and Preprocessors
Animations
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Floating Elements
Floating within a Container
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Floating Elements
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Floating Elements
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Floating Elements
Floating within a Container
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Floating Elements
Floating Multiple Items Side by Side
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Floating Elements
Floating Multiple Items Side by Side
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Floating Elements
Clear property
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Floating Elements
Containing Floats
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Floating Elements
Overlaying and Hiding Element
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Floating Elements
Overlaying and Hiding Element
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Floating Elements
Using display
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Floating Elements
Comparing visibility with display
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Floating Elements
Using Hover with display
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Chapter 7
1 Normal Flow
2 Positioning
Elements
Constructing
3 Floating
Elements 4 Multicolumn
Layouts
5 Approaches to
CSS Layouts 6 Responsive
Design
Filters,
7 8
CSS Frameworks
Transitions, and and Preprocessors
Animations
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Constructing Multicolumn Layout
Using Floats to Create Columns
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Constructing Multicolumn Layout
Using Floats to Create Columns
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Constructing Multicolumn Layout
Using Floats to Create Columns
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Constructing Multicolumn Layout
3 column example
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Constructing Multicolumn Layout
3 column example with nested floats
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Constructing Multicolumn Layout
Using Positioning to Create Columns
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Constructing Multicolumn Layout
Problems with Absolute positioning
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Constructing Multicolumn Layout
Solution to footer problem
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Constructing Multicolumn Layout
Using Flexbox to Create Columns
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Constructing Multicolumn Layout
The flexbox parent (container) properties
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Constructing Multicolumn Layout
The flexbox child (item) properties
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Chapter 7
1 Normal Flow
2 Positioning
Elements
Constructing
3 Floating
Elements 4 Multicolumn
Layouts
5 Approaches to
CSS Layouts 6 Responsive
Design
Filters,
7 8
CSS Frameworks
Transitions, and and Preprocessors
Animations
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Approaches to CSS Layout
Fixed Layout
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Approaches to CSS Layout
Fixed Layout
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Approaches to CSS Layout
Problem with Fixed Layout
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Approaches to CSS Layout
Liquid Layout
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Approaches to CSS Layout
Liquid Layout
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Chapter 7
1 Normal Flow
2 Positioning
Elements
Constructing
3 Floating
Elements 4 Multicolumn
Layouts
5 Approaches to
CSS Layouts 6 Responsive
Design
Filters,
7 8
CSS Frameworks
Transitions, and and Preprocessors
Animations
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Responsive Design
Responsive Layouts
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Responsive Design
4 elements
1. Liquid layouts
2. Setting viewports via the <meta> tag
3. Customizing the CSS for different viewports using
media queries
4. Scaling images to the viewport size
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Responsive Design
Setting Viewports
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Responsive Design
Setting Viewports
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Responsive Design
Media Queries
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Responsive Design
Media Queries
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Responsive Design
Media Queries
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Responsive Design
Responsive Design Patterns
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Responsive Design
Responsive Design Patterns
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Responsive Design
Responsive Design Patterns
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Responsive Design
Scaling Images
• img {
max-width: 100%;
}
• <picture>
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Responsive Design
Scaling Images
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Chapter 7
1 Normal Flow
2 Positioning
Elements
Constructing
3 Floating
Elements 4 Multicolumn
Layouts
5 Approaches to
CSS Layouts 6 Responsive
Design
Filters,
7 8
CSS Frameworks
Transitions, and and Preprocessors
Animations
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Filters, Transitions, and Animations
Filters
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Filters, Transitions, and Animations
Filters
#someImage {
filter: grayscale(100%);
/* At time of writing, Chrome and Opera needs
prefix */
-webkit-filter: grayscale(100%);
}
#anotherImage {
/* multiple filters are space separated */
filter: blur(5px) hue-rotate(60deg) saturate(2);
-webkit-filter: blur(5px) hue-rotate(60deg)
saturate(2);
}
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Filters, Transitions, and Animations
Transitions
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Filters, Transitions, and Animations
Transitions
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Filters, Transitions, and Animations
Transitions vs animations
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Filters, Transitions, and Animations
Animations
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Chapter 7
1 Normal Flow
2 Positioning
Elements
Constructing
3 Floating
Elements 4 Multicolumn
Layouts
5 Approaches to
CSS Layouts 6 Responsive
Design
Filters,
7 8
CSS Frameworks
Transitions, and and Preprocessors
Animations
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
CSS Frameworks and Preprocessors
CSS Frameworks
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
CSS Frameworks and Preprocessors
Grid in print design
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
CSS Frameworks and Preprocessors
Using Bootstrap
<head>
<link href="bootstrap.css” rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-2">
left column
</div>
<div class="col-md-7">
main content
</div>
<div class="col-md-3">
right column
</div>
</div>
</div>
</body>
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
CSS Frameworks and Preprocessors
CSS Preprocessors
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Chapter 7
1 Normal Flow
2 Positioning
Elements
Constructing
3 Floating
Elements 4 Multicolumn
Layouts
5 Approaches to
CSS Layouts 6 Responsive
Design
Filters,
7 8
CSS Frameworks
Transitions, and and Preprocessors
Animations
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Chapter 7 cont.
9 Summary
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Summary
Key Terms
• absolute positioning • filters • normal flow
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.
Questions
Randy Connolly and Ricardo Hoar Fundamentals of Web Development - 2nd Ed.