UNC BACS 200

Web Pages with HTML/CSS

Logo

Lesson 18 - Text & Color

LEARN

Office Hours

Reading for Today

Today

CSS Rule Set

css h1 { font-family: serif; font-size: 120%; }

CSS Rule Set

```css selector { property: value; / one rule / property: value; }

```

Hooking up CSS

html <head> <link rel="stylesheet" href="styles.css"> </head>

CSS Property Groups

Text Properties

font-family

```css body { font-family: Arial, Helvetica, sans-serif; }

p { font-family: "Times New Roman", Times, serif; } ```

Size Units

20px - 20 pixels 10pt - 10 points 2em - twice the line height (M) 50% - half the size

font-size

css p { font-size: 20px; /* in pixels */ font-size: 12pt; /* in points */ font-size: 150%; /* parent element */ font-size: 1.5em; /* M is line height */ }

font-weight

```css p { font-weight: 400; / normal / font-weight: normal; / 400 /

font-weight: 700;  /* bold */
font-weight: bold;  /* 700 */

font-weight: lighter;  /* parent element */

} ```

text-align

css p { text-align: left; text-align: center; text-align: right; }

text-shadow

```css h1 { text-shadow: 2px 2px; }

h2 { text-shadow: -2px -2px 4px yellow; } ```

font

css p { font: italic bold 16px Arial, sans-serif; font: 120% Times; }

Color Properties

Color Values

```css h1 { color: rgb(20%, 20%, 20%); / Red Green Blue /

color: silver;              /* Named color */

color: #0a0a0a;             /* Hex - Red Green Blue */

} ```

Hexidecimal Values

```

01ffa5 -- Hex value

R -- 01 (1) G -- ff (255) B -- a5 (165) ```

Hexidecimal Colors

```

ffffff -- white

000000 -- black

080808 -- gray

ff0000 -- red

00ff00 -- green

0000ff -- blue

```

BUILD

CSS Demo

Validator

W3Schools

Project 7 - Wanted Poster