ah teaches information design (Responsiveness and You lecture)

Responsiveness and You

Lecture outline

An introduction to responsive web design and styling your HTML with CSS. Lecture slides will be made available on the day of the lecture (March 4).

P3: Wireframes

Final P3 critiques

For next week's lecture we will need you to be in lecture, in person, with your laptops for critiques with members of Embark in attendance.

Validate, validate, validate

HTML and CSS validators help you see the errors (that you may have missed).

Why do invalid sites still work?

Browsers are kind, benevolent beings

Browsers are more likely to ignore errors then tell you about them. This makes it easier for you to make websites that 'render' but will not work consistently in the future.

Lessons from last week

There were a couple of common HTML issues that I thought it best to discuss as a class:

<img> with no caption

If you have no caption, for an image, just use the <img> element on its own. For example:

<img src="kitten.jpg" alt="A kitten spotted like a leopard preparing to pounce" height="200" width="350">

The <figure> element

The <figure> element is only necessary if we are adding a caption. Otherwise we can just use an <img> element on its own.

Spaces in files, folders and ID names

Instead of spaces, use dashes '-', underscores '_' or camel case 'camelCase' when naming files, folders or IDs.

<a href="#this is not understood"> — will not be understood as an ID.

<a href="#this-is-understood">will be understood as an ID.

<a href="#thisIsUnderstood">will be understood as an ID.

HTML exercise feedback

Grades and feedback on the HTML exercise will be released later today. Please make sure to read the comments as it will help explain how to improve your HTML moving forward.

CSS3

Cascading Style Sheets

While HTML defines the structure of the content on the page, CSS styles the page to ensure the user get's something usable. Good code will clearly separate semantic markup from styling.

Keeping them apart

A real Romeo/Juliet scenario

Rules for keeping them separate

Let's talk CSS

Oops, this code did not quite load. Please view it at https://codepen.io/andrewhaw/pen/ee24f2587ef3b5062ca772d9dd7dd589

CSS sampler

Oops, this code did not quite load. Please view it at https://codepen.io/andrewhaw/pen/62ada58a7aeb3895c7c88edaac85deed

ID vs. class

IDs must always be unique, <section id="kittens"> they can only be specified once per HTML file. While classes can be used as many times as needed<section class="group">

Specificity

The order in which things are read

  1. The style attribute: should never be used
  2. ID's: #home, #cool-stuff
  3. Classes, attributes & pseudo-classes: .home, [class], :hover

Units in CSS

In the journey to responsiveness, we want to aim for relative and scalable units as much as possible.

Rems

Rems — root-ems — are units responsive to the font-size set by the browser which help us establish easy relationships in type. As a general rule of thumb, setting your paragraphs to 1rem and scaling other things accordingly is better practice.

Oops, this code did not quite load. Please view it at https://codepen.io/andrewhaw/pen/4f1412454dca14e42d3e5d678d364aaf

Dev tools

Your new best friend

Ever wanted to know what the slides would look like with a red background? Right-click and 'Inspect Element' opens up the development tools to mess around with things in.

The box model

content-box vs border-box

Oops, this code did not quite load. Please view it at https://codepen.io/andrewhaw/pen/a63b4e018122c1404ed8ff7999cafc1f

Block, inline, and inline-block

Block elements break to the next line, can have a height and width, and by default are full-width.

Block One
Second Block

Inline elements stay in-line with other inline elements, and listen to their content for their sizing.

Inline One
Second Block

Inline-block elements stay in-line with other inline elements, can have a height and width, and listen to their content for their sizing.

Inline-block One
Second Inline-block
Exercise #7

Next lecture

Build Responsively

Focusing on the building of responsive web layouts and an introduction to your final project. Lecture recordings will be available within two days after the lecture.

1/1