14
Professor [email protected] Fundamentals of Web Programming Fall 2021

Fundamentals of Web Programming - cs.dartmouth.edu

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Fundamentals of Web Programming - cs.dartmouth.edu

Professor [email protected]

Fundamentals of Web ProgrammingFall 2021

Page 2: Fundamentals of Web Programming - cs.dartmouth.edu

Style with CSS

Page 3: Fundamentals of Web Programming - cs.dartmouth.edu

CSSMain idea: changing the style sheet changes the

presentation, without changing the content.

• productivity: focus on content first • division of labor: content-producers and artists • adaptability: re-styling is easy

Why?

Page 4: Fundamentals of Web Programming - cs.dartmouth.edu

1. select some of the tagged regions in an HTML doc. 2. Change the style: properties like color, position, etc.

Style block in head section. (better: put in separate file)

Page 5: Fundamentals of Web Programming - cs.dartmouth.edu

<selector> { property: value; property: value; property: value; }

Two things to learn: 1) more interesting selectors 2) some properties

Page 6: Fundamentals of Web Programming - cs.dartmouth.edu

Positioning with float

Page 7: Fundamentals of Web Programming - cs.dartmouth.edu

Positioning with float

Page 8: Fundamentals of Web Programming - cs.dartmouth.edu

Selecting specific items: id

Attribute to label an item in HTML (id attribute, double quotes)

# selector in CSS chooses labelled item

Page 9: Fundamentals of Web Programming - cs.dartmouth.edu

Selecting groups of items: class

Page 10: Fundamentals of Web Programming - cs.dartmouth.edu

Selecting groups of items: class. selector in CSS chooses labelled itemS

attributes label items in HTML (class attribute, double quotes)

Page 11: Fundamentals of Web Programming - cs.dartmouth.edu

slicing HTML content: <span>What if you want to make only part of a paragraph red?

Page 12: Fundamentals of Web Programming - cs.dartmouth.edu

Exercise: red flying objects

Page 13: Fundamentals of Web Programming - cs.dartmouth.edu

Answer: red flying objects

Page 14: Fundamentals of Web Programming - cs.dartmouth.edu

Example: navbar