Search Header Logo
CSS in a Nutshell

CSS in a Nutshell

Assessment

Presentation

β€’

Computers

β€’

6th - 8th Grade

β€’

Practice Problem

β€’

Medium

Created by

Kimberly Lewis

Used 13+ times

FREE Resource

13 Slides β€’ 11 Questions

1

media

CSS in a Nutshell

2

Open Ended

What do you think we use CSS for?

3

media

CSS is for Appearance

  • ​Colors

  • Position

  • Size

  • Text wrapping

  • Etc.

4

CSS is NOT like HTML.

HTML can and will take a lot of terrible code. CSS does not. If you mess up your CSS, it won't work. That includes punctuation and dashes.

.

However, it doesn't seem to care about indentation.

5

  • CSS is mixed into the HTML document.

  • Applies CSS to just one page.

  • NOT ALLOWED IN CLASS.

Internal

  • CSS is in its own document

  • Applies CSS to the whole website.

  • This is the ONLY way we do CSS in this class.

External

Internal vs. External CSS

6

  • Adds CSS directly to a single line of html.

  • You are NEVER allowed to use it.

Inline

  • Goes between <style> tags

  • Writes like regular CSS between those tags.

Internal

Internal CSS: Inline or Internal

7

Why don't we use internal CSS?

Internal CSS can break html. It basically works until it doesn't. You aren't doing anything that will break the html, but this is for learning good code habits, not fancy CSS. As a rule, we try to keep our CSS separate from our html.

Inline CSS in particular is notorious for breaking whole websites. It's never allowed in class.

8

media

Selector tells the CSS where to apply the appearance changes.

​

CSS Selectors

9

Selectors:

There are several ways to use selectors.

  • Simply put the html tag into your selector to change all everything with that html tag.

  • Add the attribute id="[choose your own]" to your html and use #[id name] to choose a single item to apply changes to.

  • If you want several html elements to have these changes, use class="[choose your own]" and make the selector .[class name]

10

Match

Match the following selectors to their html counterpart (Note: Closing tags are not provided).

h1 {}

#foo

.bar

h1.bar

<h1>

id = "foo"

class = "bar"

<h1 class = "bar">

11

media

This is where we do the actual changing. We divide declaration blocks into two parts: the property, and the value.

​

Declaration Blocks

12

This is the specific change you're making. You're changing the background color in the property, and now you're changing it to blue in the value.

Value

Property says what you're changing. The color? The location? The font family? It's choosing a subject to change.

Property

Property and Value

13

Hotspot

Select all the properties

14

Hotspot

Select all the values

15

Labelling

Label the Selector, property, value, and a declaration block.

Drag labels to their correct position on the image
Selector
Property
Value
Declaration Block

16

Multiple Choice

True or false: You don't need the semi-colon at the end of a declaration block.

1

True: Web code isn't like Python

2

False: It's in the pictures for a reason

17

media

Float moves blocks (like images or div tags) from one side of the screen to another, and wraps text around them. You can float left or right. You can technically float center, but you shouldn't try it because sometimes it... breaks.

Float

18

media

Normally, you can just use font, and it will work. But replit is weird. It only lets you use font-family.

​

Font-Family

19

media

​Start by choosing a font. Then, assume it won't work. Choose the next font you'd like. Then finally either a serif or sans-serif font the browser may have.

20

Multiple Choice

Why do we use font-family and not font?

1

It's superior to font

2

font is depreciated

3

Replit is weird

4

Ms. Lewis says so.

21

Multiple Choice

When are we allowed to use inline CSS in class?

1

When needed

2

During your About Me assignment

3

NEVER

4

When you feel like it

22

Multiple Choice

Where should the CSS go?

1

In its own document

2

As an html attribute (inline)

3

On the moon

4

Anywhere.

23

Multiple Select

What is something we can we use float on? (select all that apply)

1

Text

2

An image

3

A header

4

A div tag

24

Hotspot

Which image has had float used on it?

media

CSS in a Nutshell

Show answer

Auto Play

Slide 1 / 24

SLIDE