navigation · objectives • restructure the multicolumn layout to participate in a tabbed...

27
Navigation Web Development

Upload: others

Post on 24-Aug-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Navigation

Web Development

Page 2: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Lab 03b: Multicolumn Layout

2

Page 3: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Lab 04a: Tabbed Navigation

3

Page 4: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Objectives

• Restructure the multicolumn layout to participate in a tabbed navigation structure

• Do this in 2 stages

• Stage 1

• Create a series of test pages, and have the navigation section duplicated across these pages

• Incorporate links into these navigation elements

• Stage 2

• Moving the navigation section to the top of the page

• Make the list element inline and without decoration

• Devise a set of rules that style the navigation bar appropriately

4

Page 5: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Stage 1: Html

5

home.html

page2.html

page1.html

Page 6: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Stage 1: Review Html

6

home.html

page2.html

page1.html

Page 7: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Stage 1: Introduce <div> Sections in page1.html

7

Page 8: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Stage 1: Introduce <div> in page2.html

8

Page 9: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Stage 1: Copy Navigation + Footer Sections to page1.html

9

• Essentially we are duplication these two sections in each page on our site

Page 10: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Stage 1: Copy Navigation + Footer Sections to page2.html

10

Page 11: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Stage 1: Incorporate Links into All

Navigation Sections

• Introduce Links into all pages

• Site is now navigable

11

<div id="navigation"> <ul> <li><a href="home.html">Mauris</a></li> <li><a href="page1.html">Cras</a> </li> <li><a href="page2.html">Proin</a></li> <li>Integer</li> <li>Curabitur</li> <li>Integer</li> <li>Suspendisse</li> <li>Quisque</li> </ul> </div>

Page 12: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Stage 1: Differentiate Links

• Only have link to other pages in nav structure

• This may give the user a better understanding of page is the “current” page

12

<div id="navigation"> <ul> <li>Mauris</li> <li><a href="page1.html">Cras</a> </li> <li><a href="page2.html">Proin</a></li> <li>Integer</li> <li>Curabitur</li> <li>Integer</li> <li>Suspendisse</li> <li>Quisque</li> </ul> </div>

<div id="navigation"> <ul> <li><a href="home.html">Mauris</a></li> <li>Cras </li> <li><a href="page2.html">Proin</a></li> <li>Integer</li> <li>Curabitur</li> <li>Integer</li> <li>Suspendisse</li> <li>Quisque</li> </ul> </div>

<div id="navigation"> <ul> <li><a href="home.html">Mauris</a></li> <li><a href="page1.html">Cras</a> </li> <li>Proin</li> <li>Integer</li> <li>Curabitur</li> <li>Integer</li> <li>Suspendisse</li> <li>Quisque</li> </ul> </div>

home.html

page2.html

page1.html

Page 13: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Stage 1: Final

13

home.html

page2.html

page1.html

Page 14: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Objectives

• Stage 1

• Create a series of test pages, and have the navigation section duplicated across these pages

• Incorporate links into these navigation elements

• Stage 2

• Moving the navigation section to the top of the page

• Make the list element inline and without decoration

• Devise a set of rules that style the navigation bar appropriately

14

Page 15: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Stage 2: Review CSS

15

body{ width: 80%; margin: 0 auto;}

#maincontent { width: 80%; float: right; }

#navigation { width: 18%; float: left; }

#header { width: 100%; }

#footer { width: 100%; clear: both;}

#primary { width: 68%; float: left; }

#secondary { width: 30%; float: right;}

Page 16: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Navigation

• Currently, all elements have the same navigation section

• If we are to have distinct styles depending on the page being rendered, we will need to distinguish the navigation sections in each page

16

<div id="navigation"> <ul> <li><a href="home.html">Mauris</a></li> <li><a href="page1.html">Cras </a></li> <li><a href="page2.html">Proin</a></li> <li><a href="page3.html">Integer</a></li> <li>Curabitur</li> <li>Integer</li> <li>Suspendisse</li> <li>Quisque</li> </ul> </div>

all pages

Page 17: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

“Current” item

• Each page has the notion of a ‘current’ item.

• This corresponds to the actual page the user is visiting

17

<div id="navigation"> <ul> <li class="current"><a href="home.html">Mauris</a></li> <li><a href="page1.html"> Cras </a></li> <li><a href="page2.html">Proin</a></li> <li><a href="page3.html">Integer</a></li> <li>Curabitur</li> <li>Integer</li> <li>Suspendisse</li> <li>Quisque</li> </ul> </div>

<div id="navigation"> <ul> <li><a href="home.html">Mauris</a></li> <li class=“current"><a href="page1.html"> Cras </a></li> <li><a href="page2.html">Proin</a></li> <li><a href="page3.html">Integer</a></li> <li>Curabitur</li> <li>Integer</li> <li>Suspendisse</li> <li>Quisque</li> </ul> </div>

<div id="navigation"> <ul> <li><a href="home.html">Mauris</a></li> <li><a href="page1.html"> Cras </a></li> <li class="current"><a href="page2.html">Proin</a></li> <li><a href="page3.html">Integer</a></li> <li>Curabitur</li> <li>Integer</li> <li>Suspendisse</li> <li>Quisque</li> </ul> </div>

home.html

page1.html

page2.html

Page 18: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Have menu occupy full width of page

18

#navigation{ width: 100%; float: left; }

Page 19: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

ID for Menu

• Introduce and id for the <ul> element.

• We will use this to style this element

19

<div id="navigation"> <ul id="menu"> <li class="current"><a href="home.html">Mauris</a></li> <li><a href="page1.html"> Cras </a></li> <li><a href="page2.html">Proin</a></li> <li><a href="page3.html">Integer</a></li> <li>Curabitur</li> <li>Integer</li> <li>Suspendisse</li> <li>Quisque</li> </ul> </div>

Page 20: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Make each <ul> ‘inline’

20

ul#menu li { display:inline; }

• This will keep all <li> elements on a single line

Page 21: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

maincontent width

21

#maincontent{ width: 100%; float: right;}

Page 22: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Compressing the tab bar

22

ul#menu { margin: 0; padding: 0;}

Page 23: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Aligning tab elements

23

ul#menu li { display: inline; line-height: 2em; padding-right: .5em; padding-left: .5em;}

Page 24: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Disabling ‘decoration’

24

ul#menu a{ text-decoration: none;}

Page 25: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Set border around main content

25

#maincontent{ width: 100%; float: right; padding: 2%; border: blue solid 1px;}

Page 26: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

‘Active’ tab highlight

26

#menu li.current a { background: blue; padding: .5em 2em .5em 2em; color:white;}

Page 27: Navigation · Objectives • Restructure the multicolumn layout to participate in a tabbed navigation structure • Do this in 2 stages • Stage 1 • Create a series of test pages,

Summary

27

body{ width: 80%; margin: 0 auto;}

#maincontent{ width: 100%; float: right; padding: 2%; border: blue solid 1px;}

#navigation{ width: 100%; float: left; }

#header{ width: 100%;}

#footer{ width: 100%; clear: both;}

#primary{ width: 68%; float: left; }

#secondary{ width: 30%; float: right;}

ul#menu { margin: 0; padding: 0;}

ul#menu li { display: inline; line-height: 2em; padding-right: .5em; padding-left: .5em;}

ul#menu a{ text-decoration: none;}

#menu li.current a { background: blue; padding: .5em 2em .5em 2em; color:white;}