html / css – basics ii

23
HTML / CSS – Basics II You have the content. Now make it look nice.

Upload: lavada

Post on 24-Feb-2016

35 views

Category:

Documents


0 download

DESCRIPTION

HTML / CSS – Basics II. You have the content . Now make it look nice . Remember the Division?. Content. Presentation. Structure. Layout / Design. Back to the HTML- Structure. < html > < head > Some Title < body > Some < em > content - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: HTML / CSS – Basics II

HTML / CSS – Basics II

You have the content.Now make it look nice.

Page 2: HTML / CSS – Basics II

Remember the Division?

HTML CSS

Content Presentation

Structure Layout / Design

Page 3: HTML / CSS – Basics II

Back to the HTML-Structure

<html><head><title>Some Title</title>

</head><body><p>Some <em>content</em></p>

</body></html>

Page 4: HTML / CSS – Basics II

Back to the HTML-Structure

<html> <body> <p> <em>

Page 5: HTML / CSS – Basics II
Page 6: HTML / CSS – Basics II

Cascade down

Page 7: HTML / CSS – Basics II

<html>

<head>

<title>

<body>

<h1> <p>

<em>

Back to the HTML-Structure

Cascade down

Page 8: HTML / CSS – Basics II

Syntax

h1 { font-size: 16pt; color: green;}

Page 9: HTML / CSS – Basics II

h1 { font-size: 16pt; color: green;}

SyntaxSelector

Declaration

Page 10: HTML / CSS – Basics II

Syntax

h1 { font-size: 16pt; color: green;}

Selector Property Value and Unit

Property Value

Declaration

Page 11: HTML / CSS – Basics II

html body p em { font-size: inherit; font-style: italic;}

<html> <body> <p> <em>

Why “Cascade”?

Page 12: HTML / CSS – Basics II

Include Styles

<link href="styles.css" rel="stylesheet" type="text/css" />

Page 13: HTML / CSS – Basics II
Page 14: HTML / CSS – Basics II

3 Ways of Inclusion

1. Inline Style2. Embedded Style Sheets3. External Style Sheets

Page 15: HTML / CSS – Basics II

1. Inline Style

<p style="color:red;">I’m red!</p>

Very specific, only this very element

dw

Page 16: HTML / CSS – Basics II

2. Embedded Style Sheet

<style type="text/css"><!--

p { font-size: 9pt; }--></style>

Only this documentdw

Page 17: HTML / CSS – Basics II

3. External Style Sheet

<link href="styles.css" rel="stylesheet" type="text/css" />

All the documents;Change once, apply to all (Hooray!)

dw

Page 18: HTML / CSS – Basics II

3 Ways of Selection

1. Type Selectors2. Class and ID Selectors3. Special Seletion

Page 19: HTML / CSS – Basics II

1. Type Selectors

p {color:red;

}

Triggers the style of an HTML tag

dw

Page 20: HTML / CSS – Basics II

2. Class and ID Selectors

.red {color:red;

}

Triggers the style of an HTML tag that has the attribute class="red"

Appears as often as you wishdw

Page 21: HTML / CSS – Basics II

2. Class and ID Selectors

#menu {margin:0px;

}

Triggers the style of an HTML tag that has the attribute id="menu"

Appears only oncedw

Page 22: HTML / CSS – Basics II

3. Special Selection

Contextual#menu ul { list-style:none; }

Short Hand#content, #footer

{ width:750px; }

Pseudoselectorsa:hover { color:green; }

Page 23: HTML / CSS – Basics II

The Box Model

Contentpaddingbordermargin

margin edgeborder edge

padding edgecontent edge