+ All Categories
Home > Documents > CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito...

CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito...

Date post: 02-Jan-2016
Category:
Upload: lee-hawkins
View: 218 times
Download: 3 times
Share this document with a friend
30
CSCE 102 – Chapter 6 (Web Design and Layout CSCE 102 - General Applications Programming Benito Mendoza 1 22/3/19 Benito Mendoza 1 By Benito Mendoza Department of Computer Science & Engineering Layout with Style Layout with Tables Frames and Multiple Windows
Transcript
Page 1: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout)

CSCE 102 - General Applications Programming

CSCE 102 - General Applications Programming

Benito Mendoza 123/4/20 Benito Mendoza 1

By

Benito Mendoza

Department of Computer Science & Engineering

Layout with StyleLayout with Tables

Frames and Multiple Windows

Page 2: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 223/4/20 Benito Mendoza 2

The goal of this chapter is to learn how to segment content in the browser window. Three different methods exist:

style rules, tables, and frames.

All can be used to create complex layouts like the often-used magazine-style configuration.

Layout with StyleLayout with Tables

Frames and Multiple Windows

Page 3: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 323/4/20 Benito Mendoza 3

Curiously, tables, are used by many web designers to organize information on the page because of their near universal support. The concept of frames is introduced which allows more than one document to be loaded and viewed in the browser window at the same time. Finally, we show how to open new document windows.

Layout with StyleLayout with Tables

Frames and Multiple Windows

Page 4: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 4

Page elements are interpreted:Top to bottomLeft to right

Can control some placement with float property or align attributeposition property of style sheets provides specific placement information

Creating an Internal Style SheetExperimenting with ColorsChanging the Alignment

Layout with StyleLayout with Tables

Frames and Multiple Windows

Normal flow

Page 5: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 5

Layout with Style<style type=”text/css”> img.tower {position:absolute; top:75; left:150}</style>

…<img class=“tower” src=“eiffel.jpg” />…

Creating an Internal Style SheetExperimenting with ColorsChanging the Alignment

Layout with StyleLayout with Tables

Frames and Multiple Windows

Page 6: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 6

Placement is relative to containing blockCould place image inside a paragraph that was itself positioned at some absolute set of coordinatesCaution – using position removes the image from the normal flow but not anything else!

Creating an Internal Style SheetExperimenting with ColorsChanging the Alignment

Layout with StyleLayout with Tables

Frames and Multiple Windows

Page 7: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 7

Magazine style

Set height and width for most current monitors:

Height = 400-500 pixelsWidth = 600 pixelsNo scrolling required

See Figures 6.1 & 6.2, p. 144-145

Creating an Internal Style SheetExperimenting with ColorsChanging the Alignment

Layout with StyleLayout with Tables

Frames and Multiple Windows

Page 8: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 8

Title

Image

Column 1 Column 2

Column 3

600 pixels

500 pixels

Creating an Internal Style SheetExperimenting with ColorsChanging the Alignment

Layout with StyleLayout with Tables

Frames and Multiple Windows

Page 9: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 9

Using <div>Use <div> elementDefine a custom block-level element for each section of the layout

Creating an Internal Style SheetExperimenting with ColorsChanging the Alignment

Layout with StyleLayout with Tables

Frames and Multiple Windows

Page 10: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 10

Layout with Style<style type=“text/css”> div.title {…} div.image {…} div.col1 {…} div.col2 {…} div.col3 {…}</style>

Creating an Internal Style SheetExperimenting with ColorsChanging the Alignment

Layout with StyleLayout with Tables

Frames and Multiple Windows

Page 11: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 11

Layout with Style

<style type=“text/css”> div.title {position:absolute; top:0; left:0; height:60;

width:600 }</style>

…<div class=“title”> … </div>…

Creating an Internal Style SheetExperimenting with ColorsChanging the Alignment

Layout with StyleLayout with Tables

Frames and Multiple Windows

Page 12: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 12

Padding and Overflow

padding – number of pixels between border and text (padding n or padding x y)overflow – whether or not text outside the borders is visible

hiddenvisible

Creating an Internal Style SheetExperimenting with ColorsChanging the Alignment

Layout with StyleLayout with Tables

Frames and Multiple Windows

Page 13: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 13

Nested TablesInsert <table>…</table> within an existing <td>…</td> element

Layout with StyleLayout with Tables

Frames and Multiple Windows

<table><tr>

<td> </td> <td> </td>

</tr></table>

<table><tr>

<td> </td> <td> </td>

</tr></table>

Page 14: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 14

TablesPlain table

Ch06-Ex-05.html

Nested tableCh06-Ex-06.html

Layout with StyleLayout with Tables

Frames and Multiple Windows

Page 15: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 15

Divide window into separate sections like <div>Each section displays the contents of a separate HTML documentFrames may:

Have scroll barsBe resized

Layout with StyleLayout with Tables

Frames and Multiple Windows

FramesMultiple Windows

Page 16: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 16

Frames

First define a layout or frameset document:<html> <head> </head> <frameset> </frameset></html>

Layout with StyleLayout with Tables

Frames and Multiple Windows

FramesMultiple Windows

Page 17: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 17

Define structure using the frameset element

rows attributecols attribute

Units are:Percentage of window sizeNumber of pixelsRelative value

Layout with StyleLayout with Tables

Frames and Multiple Windows

FramesMultiple Windows

Page 18: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 18

FramesPercentage of window size:<frameset rows=“30%, 40%, 30%”></frameset>

Number of pixels:<frameset cols=“80, 160, 50”></frameset>

Layout with StyleLayout with Tables

Frames and Multiple Windows

FramesMultiple Windows

Page 19: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 19

Relative value:<frameset cols=“80, *, 80”></frameset>

Layout with StyleLayout with Tables

Frames and Multiple Windows

FramesMultiple Windows

Page 20: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 20

Frames can be nested<frameset cols=“50%, 50%”>

</frameset>

<frameset rows=“50%, 50%”></frameset><frameset rows=“33%, 33%, 33%”></frameset>

Layout with StyleLayout with Tables

Frames and Multiple Windows

FramesMultiple Windows

Page 21: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 21

<frameset> only specifies structure, not contentContent requires a <frame /> tagEach <frame /> tag may have seven attributes

Layout with StyleLayout with Tables

Frames and Multiple Windows

FramesMultiple Windows

Page 22: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 22

src – The URL of the HTML document that will appear in the frameid – Assigns a name to the frame so it can be referenced by links in other framesmarginwidth and marginheight – The size in pixels of the frame’s margins

Layout with StyleLayout with Tables

Frames and Multiple Windows

FramesMultiple Windows

Page 23: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 23

scrollingyes – The frame will always have scroll barsno – The frame will never have scroll barsauto – The frame lets the browser decide

noresize – The user cannot drag the frame edges to resize the frameframeborder=0 – hides the frame’s borders

Layout with StyleLayout with Tables

Frames and Multiple Windows

FramesMultiple Windows

Page 24: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 24

Include one <frame> tag for each frame:

<frameset rows=“50%, 50%”> <frame id=“upper”

src=“fred.html” /> <frame id=“lower”

src=“sam.html”/></frameset>

Ch06-Ex-07.html

Layout with StyleLayout with Tables

Frames and Multiple Windows

FramesMultiple Windows

Page 25: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 25

<noframes> element in case user’s browser doesn’t support frames:

<frameset …> <frame …> <noframes>This Web page …

</noframes></frameset>

Layout with StyleLayout with Tables

Frames and Multiple Windows

FramesMultiple Windows

Page 26: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 26

Refresh/Reload button:Reloads frame(s) contents butDoes not reload the layout (<frameset>) document

To reload a <frameset> have to use menu: File, Open, etc.

Layout with StyleLayout with Tables

Frames and Multiple Windows

FramesMultiple Windows

Page 27: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 27

Linking between frames:Click link in one frameSee result in another frame

Add target attribute to <a> tag:<a href=“…” target=“left_frame”>Click here to …</a>

Otherwise content appears in current frameCh06-Ex-08

Layout with StyleLayout with Tables

Frames and Multiple Windows

FramesMultiple Windows

Page 28: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 28

Eliminating framesFrameset hierarchy

Browser tracks framesetsBrowser window is at the “top”First <frameset> defined is “down” one level …

Browser window

1st frameset

Layout with StyleLayout with Tables

Frames and Multiple Windows

FramesMultiple Windows

Page 29: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 29

Can set target to _top:

<a href=“…” target=“_top”>…</a>

Ch06-Ex-10

Layout with StyleLayout with Tables

Frames and Multiple Windows

FramesMultiple Windows

Page 30: CSCE 102 – Chapter 6 (Web Design and Layout) CSCE 102 - General Applications Programming Benito Mendoza 1 2015-10-22 Benito Mendoza 1 By Benito Mendoza.

CSCE 102 – Chapter 6 (Web Design and Layout) Benito Mendoza 30

Multiple WindowsJust like specifying what frame in which to display a document:

<a href=“…” target=“fred”> … </a>

Ch06-Ex-11

Layout with StyleLayout with Tables

Frames and Multiple Windows

FramesMultiple Windows


Recommended