lesson 107 23 aug13-1430-ay

25
Unit 1: Web Fundamentals Lesson 7: Introduction to CSS August 21, 2013

Upload: codecademy-ren

Post on 13-May-2015

13.318 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Lesson 107 23 aug13-1430-ay

Unit 1: Web FundamentalsLesson 7: Introduction to CSS

August 21, 2013

Page 2: Lesson 107 23 aug13-1430-ay

2

Lesson 7: Introduction to CSS

Introduction to HTML

Learning to Use HTML

HTML and Email

History and Future of the

Web

HTML and Forms

Search Engine

Optimization

Learning to Use CSS

Introduction to CSS

Reusing Code

3 Ways to Use CSS

Separation of Concerns

Launching Your Own Website

Lesson 1 Lesson 2 Lesson 3 Lesson 4

Lesson 8 Lesson 7 Lesson 6 Lesson 5

Lesson 9 Lesson 10 Lesson 11 Lesson 12

Build understanding Develop skills

Page 3: Lesson 107 23 aug13-1430-ay

Recap of Lessons 1-6 (I)

3

• HTML is very important and is used in everything from websites to email messages to sending data with forms

• HTML files are easy to create – no harder than writing a Word document

Page 4: Lesson 107 23 aug13-1430-ay

Recap of Lessons 1-6 (II)

4

• We can add images and video to our HTML by using tags

• Websites such as YouTube will even give us the HTML code to make embedding content easy

Page 5: Lesson 107 23 aug13-1430-ay

Recap of Lessons 1-6 (III)

5

• Forms help us send information to a server whenever we sign in, search, or post on Facebook

• Meta tags allow us to tell potential visitors what our website is about

• Search engine optimization can help our site rank higher when websites like Google or Yahoo show search results

This is the meta description tag

Page 6: Lesson 107 23 aug13-1430-ay

6

We’ve done HTML – now let’s look at CSS

• We have seen why HTML is important, but CSS is just as useful

• When HTML provides the structure for a page, CSS lets us make it look pretty

HTML is the structure/skeleton

CSS is the presentation/clothing

jQuery/Javascript is the action/movement

Page 7: Lesson 107 23 aug13-1430-ay

7

What would websites look like without CSS? (I)

Facebook Facebook without CSS

Page 8: Lesson 107 23 aug13-1430-ay

8

What would websites look like without CSS? (II)

Pixar Pixar without CSS

Page 9: Lesson 107 23 aug13-1430-ay

9

What would websites look like without CSS? (III)

Google Google without CSS

• Even Google doesn’t look good without CSS!

Page 10: Lesson 107 23 aug13-1430-ay

10

One website can change a LOT when styled with different CSS

• Believe it or not, but the two webpages below were written using identical HTML code

• The only difference between them is in their CSS styling!

Page 11: Lesson 107 23 aug13-1430-ay

11

Restyling the Guardian (I)

1. Last time, we edited the HTML code of the Guardian website. This time, we’ll edit the Guardian’s CSS code. Open up your Chrome web browser and navigate to www.theguardian.com/uk

Page 12: Lesson 107 23 aug13-1430-ay

12

Restyling the Guardian (II)

2. Right click on the white background and click ‘Inspect Element’

‘Inspect Element’

Page 13: Lesson 107 23 aug13-1430-ay

13

Restyling the Guardian (III)

3. Next to the HTML code we looked at last time, you should see a small box in the lower right. Scroll halfway down until you see ‘background-color’

Page 14: Lesson 107 23 aug13-1430-ay

14

Restyling the Guardian (IV)

4. Click the box next to ‘white’, and then select a color in the window that appears

Click here

Page 15: Lesson 107 23 aug13-1430-ay

15

Restyling the Guardian (V)

5. Now the Guardian has a background color!

Page 16: Lesson 107 23 aug13-1430-ay

16

Restyling the Guardian (VI)

6. However, can you guess what happens when we refresh the page?

Refresh

Page 17: Lesson 107 23 aug13-1430-ay

17

Restyling the Guardian (VII)

7. The background color went back to white!

Page 18: Lesson 107 23 aug13-1430-ay

18

How does the internet work – Take #2 (I)

• To understand why our changes disappeared, we need to revisit how the internet works

ISP

Facebook server

Amazon server

Youtube server

DNS

Router

Page 19: Lesson 107 23 aug13-1430-ay

19

How does the internet work – Take #2 (III)

• Originally, we said that the Youtube server was sending Andy Murray the webpage files he requested

• But the server is sending more than just the HTML files – it’s also sending CSS files for the page

Youtube server

HTML

CSS

Page 20: Lesson 107 23 aug13-1430-ay

20

How does the internet work – Take #2 (IV)

• If Andy were to receive just the HTML files, he would see a simple version of the site

HTML

Page 21: Lesson 107 23 aug13-1430-ay

21

How does the internet work – Take #2 (V)

• If Andy were to receive just the HTML files, he would see a simple version of the site

• If he received both HTML and CSS, he would see the full website

HTML

HTML

CSS

Page 22: Lesson 107 23 aug13-1430-ay

22

How does the internet work – Take #2 (VI)

• If Andy were to receive just the HTML files, he would see a simple version of the site

• If he received both HTML and CSS, he would see the full website

• If he only received the CSS files, he would not see the website at all. You cannot add style to a page that has no structure!

HTML

HTML

CSS

CSS

Page 23: Lesson 107 23 aug13-1430-ay

23

Summary (I)

• CSS is just as important as HTML because it allows us to style a page to make it look pretty

• Changing the CSS of a site can make a big difference!

Page 24: Lesson 107 23 aug13-1430-ay

24

Summary (II)

• It’s just as easy to edit CSS as it is to revise HTML

• A server actually sends TWO files when you request a webpage – HTML and CSS

• You need both to see the full version of the website

HTML HTML

CSS

Page 25: Lesson 107 23 aug13-1430-ay

25

What to do on your own

1. Go to URL to complete the Codecademy course online

2. Do the practice set on the material learned

3. Take the follow-up quiz to test your understanding