Hero Sections
Homework
- Review
- CSS Images
- Read: Backgrounds and Borders
- Skim: Linear Gradients
- Full Viewport Containers
- Sample code
- Tissue Contrast Illusion
- Objectives 1 and 2 cover the code we’ll need for a basic hero section.
- Objective 3 comes in handy for mobile menus.
- Tissue Contrast Illusion
Morning reflection
Housekeeping
- CPNT 260 Assignment 4
- DSGN 270 Marks Published
- Changes to tomorrow’s homework
- Preliminary feedback on 260 Assignment 1:
- Code Quality
- Validation
- Broken root HTML structure. See Anatomy of an HTML document
- Significant syntax errors.
- Minor-moderate syntax errors.
- File structure
- HTML page should be named
index.html
- External css files should be in a
css
directory. - Your images should be in a dedicated
images
directory.
- HTML page should be named
- Indentation and Organization
- Indent should be 2 spaces. You can change this in your code editor preferences/settings.
- Nested code blocks should be indented.
- CSS declarations should be organized by category (box model, fonts, borders, flex, etc), separated by a space.
- Validation
- Project Documentation
- Missing README file.
- Course code and title
- Assignment title
- GH Pages link
- Attributions
- Code comments
- General reminders for yourself and hints for new developers working on your project.
- Description of obstacles you encountered during the project, theories on the nature of the problem and possible solutions.
- Missing README file.
- Code Quality
1. Full-viewport containers and centering
Learning Objectives
- Create a full viewport container using
min-height
and viewport units. - Centre an element in the viewport.
- Use
background-image
and gradients to create a split background. - Spice things up with
background-blend-mode
and transparency.
Materials
- Gist: Vertical Centering: Flex and margin: auto
- Tissue Contrast Illusion
- Examples:
Key Takeaways
- By default, empty block-level elements are
0px
tall (not includingborder
). - Before you can center an element in the viewport, a largish
height
(ormin-height
) must be set on the container to add vertical space. - Mobile viewport units are a lie! The disappearing address bar on mobile browsers create a scroll bar if
height
is set to100vh
. To be safe, setmin-height
to85vh
on mobile (for now). Search: “viewport units on mobile” for more details.
2. Live-code session
- Definition slide
- Example Hero section
Materials
- Sample Code: Landing Stock images
- Sample Fonts
Open lab-time
Find an example of a hero section online that you think you can duplicate.
- Given the layout of the hero section, what should the underlying elements look like?
- If a
background-image
is needed, what element should it be applied to? - What should the hero section look like on mobile?
Tony’s goals for Lab-Time
- Integrate Work-in-progress layout modifications into main program website.
Dailies
- Submit today’s Codepen/repo/gist to the Dailies section (in Assessments) in Brightspace.