Top Banner
HTML with Style!
16

HTML with Style!. What is a Style Sheet? CSS? Style Sheet CSSCascading Style Sheets A “language” for defining style rules. Rules that tell the browser.

Jan 18, 2016

Download

Documents

Felix Lane
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: HTML with Style!. What is a Style Sheet? CSS? Style Sheet CSSCascading Style Sheets A “language” for defining style rules. Rules that tell the browser.

HTML with Style!

Page 2: HTML with Style!. What is a Style Sheet? CSS? Style Sheet CSSCascading Style Sheets A “language” for defining style rules. Rules that tell the browser.

What is a Style Sheet? CSS?

Style Sheet

CSS Cascading Style Sheets A “language” for defining style rules.

Rules that tell the browser how to present information.

Page 3: HTML with Style!. What is a Style Sheet? CSS? Style Sheet CSSCascading Style Sheets A “language” for defining style rules. Rules that tell the browser.

Style Assignment Syntax

Target property value property2 value2

p background: YELLOW

Page 4: HTML with Style!. What is a Style Sheet? CSS? Style Sheet CSSCascading Style Sheets A “language” for defining style rules. Rules that tell the browser.

Identifying Targets 1

Selector

Class

ID Defines a style for a single element based on the element’s ID. (Avoid)

Defines a style for all elements of a given class.

Defines a style for all elements of a given type (e.g., all paragraphs).

Page 5: HTML with Style!. What is a Style Sheet? CSS? Style Sheet CSSCascading Style Sheets A “language” for defining style rules. Rules that tell the browser.

Examples

Selector

Class

ID

Class

ID

Page 6: HTML with Style!. What is a Style Sheet? CSS? Style Sheet CSSCascading Style Sheets A “language” for defining style rules. Rules that tell the browser.

Identifying Targets 2

Contextual Defines a style based on the order of selectors, going from right to left.

p em strong background: YELLOW

p em background: YELLOW

Page 7: HTML with Style!. What is a Style Sheet? CSS? Style Sheet CSSCascading Style Sheets A “language” for defining style rules. Rules that tell the browser.

Examples

Page 8: HTML with Style!. What is a Style Sheet? CSS? Style Sheet CSSCascading Style Sheets A “language” for defining style rules. Rules that tell the browser.

Examples

Page 9: HTML with Style!. What is a Style Sheet? CSS? Style Sheet CSSCascading Style Sheets A “language” for defining style rules. Rules that tell the browser.

Margin

Basic Property Groups

Font

₪Ω€Text

T he

Background

Padding

The contents go here!Border

BoxModel

Page 10: HTML with Style!. What is a Style Sheet? CSS? Style Sheet CSSCascading Style Sheets A “language” for defining style rules. Rules that tell the browser.

Internal Style Sheets

Page 11: HTML with Style!. What is a Style Sheet? CSS? Style Sheet CSSCascading Style Sheets A “language” for defining style rules. Rules that tell the browser.

Local (Inline) Styles

Page 12: HTML with Style!. What is a Style Sheet? CSS? Style Sheet CSSCascading Style Sheets A “language” for defining style rules. Rules that tell the browser.

External Style Sheets

Page 13: HTML with Style!. What is a Style Sheet? CSS? Style Sheet CSSCascading Style Sheets A “language” for defining style rules. Rules that tell the browser.

CSS Order Matters

1

2

3

1

Page 14: HTML with Style!. What is a Style Sheet? CSS? Style Sheet CSSCascading Style Sheets A “language” for defining style rules. Rules that tell the browser.

Why Style Sheets?

+ Flexible, powerful presentation.

+ Control – author, user, browser.

+ Clearly separates content and presentation.

+ Transition to future technologies.

– Can get confusing (e.g., conflicts)

Page 15: HTML with Style!. What is a Style Sheet? CSS? Style Sheet CSSCascading Style Sheets A “language” for defining style rules. Rules that tell the browser.

div And span

• Both group information.

• Great for formatting all sorts of elements!

• div– Block level.

• span– Inline.

Page 16: HTML with Style!. What is a Style Sheet? CSS? Style Sheet CSSCascading Style Sheets A “language” for defining style rules. Rules that tell the browser.

We have just skimmed the surface of CSS! Feel free to explore.

By the way, CSS3 is under development right now.