Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

42
Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1

Transcript of Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

Page 1: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan

1

Page Layout

Page 2: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan

2

Summary of the previous lecture

• Font properties• Controlling text with CSS• Styling links• Styling background• Styling tables

Page 3: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan

3

Outline

• The process to design a page layout• div tag• Coding a page using divs and CSS

Page 4: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

4

Consider a web application to develop

• CONNECTIONS: a smaller version of social web

• Users can register themselves • After registration they can send a text

message to anybody who is registered with the website

• User’s can view the received messages

Page 5: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

5

1. The process

• Determine the requirements of the site• Group the required information• Make a site map• Identify key elements for each page• Decide about the arrangement of

information on each page• Translate the design into code

Page 6: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

6

1.1 Determining requirements• Under standing the audience• Who? Who will visit the site?– You can create fictional visitors – Men and women of 20 to 50 years of age

• Why? Why have they come to your site? – Send messages – View received messages

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

Page 7: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

7

1.1 Determining requirements…• What? What does a visitor need to achieve a

goal?– Will they be familiar with your product?

• How often? How often can you realistically expect them to visit?– In-order to make changes

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

Page 8: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

8

1.1 Determining requirements…• Things You Want the Site to Do• Determining the requirement of the owner of

the site which are not already listed– User must register themselves in-order to send

and receive messages

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

Page 9: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

9

1.2 Grouping and categorization

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

• Group related information/sections– Home page: login form, registration form– User page: user’s information, recent messages– Inbox: Received messages– Outbox: Sent messages– Send a message: Send message form

Page 10: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

10

1.3 Make a site map…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

• Site map shows how many pages you need and how they relate

• Usually look like either a family tree or folder list

Page 11: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

11

1.3 Make a site map

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

Home page

User page

Inbox

Outbox

Send a message

Page 12: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

12

1.4 Key element for each page

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

• Common sections (header, navigation, footer etc.)

• Page specific sections• Common Sections (header, footer)• Page specific sections• Home page: login form, registration form• User page: user’s information, recent

messages

Page 13: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

13

1.4 Key element for each page…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

• Inbox page: received messages• Outbox page: messages sent by the user• Send message page: form to send a message

Page 14: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

14

1.5 Arranging elements on pages

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

Web Page

headerLogo

Login form

Sign-In form

Footer

Page 15: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

15

1.5 Arranging elements on pages…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

User Info

User Picture

User data

Actions

Recent Messages

Message

Page 16: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

16

2. Translating design into code

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

• Liquid vs Fixed design• The Div tag• Coding the design

Page 17: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

17

2.1 Liquid vs Fixed design

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

• Liquid Design– designs automatically fits to the screen– Use percentage values to declare height and

width of sections• Fixed design– Designs remain fixed width– Use fixed values to declare height and width of

sections

Page 18: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

18

2.2 The <div> tag

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

• Defines a division or section in an HTML document

• Visually, allows us to make containers that can be formatted

• Can be declared as• <div>……</div>

Page 19: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

19

2.2 The <div> tag

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

Starts a div

Div style

Div contentsDiv ends

Second div

Page 20: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

20

2.2 The <div> tag…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

First divSecond div

Page 21: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

21

2.3 Coding the design

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

<div id=“container”><div id=“header”><div id=“logo”></div></div> //header div ends</div> //container div ends

Page 22: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

22

2.3 Coding the design…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

<div id=“container”>Header and logo divs<div id=“center-content”><div id=“form-containter”><div class=“form-heading”>Heading text </div><div class=“form-rows”>Form element </div></div> //form container ends</div> //end of center content</div> //container div ends

Page 23: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

23

2.3 Coding the design…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

<div id=“container”>Header and logo divs<div id=“center-content”>Login form div’s<div id=“form-containter”><div class=“form-heading”>Heading text </div><div class=“form-rows”>Form element </div></div> //form container ends</div> //end of center content</div> //container div ends

Page 24: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

24

2.3 Coding the design…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

<div id=“container”>Header and logo divs<div id=“center-content”>Login form div’sRegistration form div’s</div> //end of center content<div id=“footer”></div></div> //container div ends

Page 25: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

25

2.3 Coding the design…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

• Divs required to make the structure:• Main container• Header • Logo• Center container• Form container• Form heading• Form row

Page 26: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

26

2.3 Coding the design…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

Main container

Page 27: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

27

2.3 Coding the design…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

Header div

Page 28: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

28

2.3 Coding the design…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

Logo div

Page 29: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

29

2.3 Coding the design…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

Center content

Page 30: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

30

2.3 Coding the design…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

Form heading

Form row

Page 31: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

31

2.3 Coding the design…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

Styling label

Styling input field

Page 32: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

32

2.3 Coding the design…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

Div adding space

Footer div

Page 33: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

33

2.3 Coding the design…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

Container div

Header div

Logo div

Header ends

Container ends

Page 34: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

34

2.3 Coding the design…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

Page 35: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

35

2.3 Coding the design…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

Center content starts

Form container start

Form headingForm starts

Row startsLabel

Input fieldRow ends

Form container end

Center content ends

Page 36: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

36

2.3 Coding the design…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

Page 37: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

37

2.3 Coding the design…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

Space is added

Form container

heading

Form row

Second row

Page 38: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

38

2.3 Coding the design…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

Page 39: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

39

2.3 Coding the design…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

Footer div

Page 40: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

40

2.3 Coding the design…

Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan

Page 41: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan

41

Summary

• The process to design a page layout• div tag• Coding a page using divs and CSS

Page 42: Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.

Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan.

42

• Chapter 9, Beginning HTML, XHTML,CSS, and JavaScript, by Jon Duckett, Wiley Publishing; 2009, ISBN: 978-0-470-54070-1.

References