Layout

12
Layout Presenting Content – Session “CSS Layout Techniques”

description

 

Transcript of Layout

Page 1: Layout

Layout

Presenting Content – Session “CSS Layout Techniques”

Page 2: Layout

CSS Layout Aspects

1. Width and Height2. Margin and Padding3. Floating Elements4. Positioning5. “Semantic” Layout

Page 3: Layout

Exkursion: The Box Model

Contentpaddingbordermargin

margin edgeborder edge

padding edgecontent edge

Page 4: Layout

The Box Model in Real Life

Page 5: Layout

The Box Model in Real Life

marginca. 20px

0px

ca. 10px

width:ca. 100px

border

padding

content

Page 6: Layout

1. Width and Heightwidth and height always refer to the content, all other values add up to that.

FF

Page 7: Layout

2. Margin and Padding

• Use to implement perception laws• Use to make the layout less stuffed

better usability

better readability

Page 8: Layout

3. Floating Elements

floats left

floats right

relation of image tosurrounding text?!?

DW

Page 9: Layout

4. Positioning

• static (no specific position, normal flow)

• relative (relative to itself)

• absolute (in relation to parent)

• fixed (in relation to viewport)

Page 10: Layout

4. Positioning

• new HTML file

• 3 divs

• 3 different colors

• CSS for document only

DW

Page 11: Layout

5. “Semantic” Layout

a. Importance and Position

b. <div> vs HTML5An area in XHTML… …becomes an element in HTML5

<div id="header"> <header>

<div id="menu"> <nav>

<div id="footer"> <footer>

Page 12: Layout

5. “Semantic” Layout

c. Position and Relation„Lorem ipsum dolor sit amet,consectetur adipisicing elit, seddo eiusmod tempor incididuntut labore et dolore magnaaliqua. Ut enim ad minimveniam, quis nostrud exercita-tion ullamco laboris nisi ut ali-quip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.