Search Header Logo
CSS

CSS

Assessment

Presentation

Computers, Fun

Professional Development

Practice Problem

Medium

Created by

Robert Anderson

Used 44+ times

FREE Resource

9 Slides • 7 Questions

1

Intro to CSS

Cascading Style Sheets

media

2

What is CSS?

CSS is what we will use to make our webpages look nice and unique. They are separate files that we create that can be linked to our HTML to enhance the overall page.

media

3

Breakdown

  • Yellow: The first part is the "selector". This lets our HTML know what we are referring to.

  • Green: The next part is the entire declaration we are making.

  • Pink: Inside of the { } is where we will "declare" our style choices. "property: value;" pairs.

  • Orange: The first part of our pair is the "property" which states what type of style we are referring to.

  • Blue: The second part is the "value" which states the specific setting or numeric value we want to assign.

media

4

Multiple Choice

What does CSS stand for?

1

Cascadian Street Slang

2

Cruising Style Stools

3

Cascading Style Sheets

4

These are all wrong

5

Multiple Choice

Choose the correct property value pair.

1

propert; value;

2

property: value:

3

property: value

4

property: value;

6

Classes and ID's

  • A 'class' is an attribute assigned to an HTML element. It can be assigned to as many different elements as we would like. It is best used though for elements that are used for the same purpose.

  • An 'id' is also an attribute assigned to an HTML element. It is a specific and unique value that cannot be used anywhere else.

media

7

Selectors and Specificity

  • General element selectors can be used to style every element in your HTML that matches the selector (least specific)

  • When a "." starts the selector we are referring to a "class". So any element with an attribute of 'class=bill-images' will be assigned the same style as each other. (more specific)

  • When a "#" starts the selector we are referring to an "id". Each "id" is unique and can only be applied once. The one element with the attribute of 'id=quote' will be assigned the style choices declared

media

8

Multiple Choice

If I wanted to assign an attribute to style every single <p> tag what would work best?

1

p {color: blue;}

2

.p {color: blue;}

3

.paragraphs {color: blue;}

4

#paragraphs {color: blue;}

9

Multiple Choice

What selector is most specific?

1

h1 {height: 200px;}

2

#this-one {height: 200px;}

3

.theseOnes {height: 200px;}

4

* {height: 200px;}

10

3 Different ways to link CSS to HTML

  • 1) In-line (not best practice, gets messy, hard to keep track of, not DRY)

  • What is DRY? (Don't Repeat Yourself) The practice of trying to write code that can be used and re-used multiple times instead of writing it over and over and over... and over and over.

  • 2) Inside of the <style></style> element we can put inside of the <head></head> element in our HTML file. (Better than 'in-line', good for learning and working on small activities, still not best practice.)

  • 3) Create a separate file with a ".css" extension and <link> the file to our HTML. (Best practice, keeps our HTML and CSS separate and keeps our code clean. We love clean code.)

11

CSS in-line

Written inside of the HTML element, only pertains to that specific element.


"style='property: value' "

media

12

CSS in <style> tags inside the <head>

Better than in-line. Can use general element selectors, class selectors, id's, and everything else in-between.


Still not best practice, can get messy and cumbersome as code grows. Too much going on in one place.

media

13

CSS <link>'ed!

Using a <link href="bill.css" rel="stylesheet" > inside of our <head> we can then write our CSS in a separate file to keep our code clean and easy to use.


This allows us to use our CSS on any HTML file we want to, by just adding a <link> in that HTML file. This helps with our practice of DRY coding.

media

14

Multiple Choice

Can you assign styles to a "class" with in-line CSS?

1

Yes

2

No

3

What is in-line styling?

4

Where am I?

15

Multiple Choice

How many elements can share the same "id"?

1

None, There can be only 1 element per "id".

2

Any element of the same type.

3

Any element with the same class.

4

All of them.

16

Multiple Choice

Can an HTML element have more than 1 "class"?

1

Yes

2

No

3

What's an element?

4

Where am I, and how did I get here?

Intro to CSS

Cascading Style Sheets

media

Show answer

Auto Play

Slide 1 / 16

SLIDE