Review: Test 2 Chapters 6-9 The Box Model Content Text & web - - PowerPoint PPT Presentation

review test 2
SMART_READER_LITE
LIVE PREVIEW

Review: Test 2 Chapters 6-9 The Box Model Content Text & web - - PowerPoint PPT Presentation

Review: Test 2 Chapters 6-9 The Box Model Content Text & web page elements in the container Padding Area between the content and the border Border Between the padding and the margin Margin Determines the


slide-1
SLIDE 1

Review: Test 2

Chapters 6-9

slide-2
SLIDE 2

The Box Model

  • Content
  • Text & web page elements in

the container

  • Padding
  • Area between the content and

the border

  • Border
  • Between the padding

and the margin

  • Margin
  • Determines the empty space

between the element and adjacent elements

2

slide-3
SLIDE 3

Configure Margin with CSS

  • The margin property
  • Related properties:
  • margin-top, margin-right, margin-left, margin-bottom
  • Configures empty space between the element and adjacent

elements

  • Syntax examples

h1 { margin: 0; } h1 { margin: 20px 10px; } h1 { margin: 10px 30px 20px; } h1 { margin: 20px 30px 0 30px; }

slide-4
SLIDE 4

Configure Padding with CSS

  • The padding property
  • Related properties:
  • padding-top, padding-right, padding-left,

padding-bottom

  • Configures empty space between the content of the HTML

element (such as text) and the border

  • Syntax examples

h1 { padding: 0; } h1 { padding : 20px 10px; } h1 { padding : 10px 30px 20px; } h1 { padding : 20px 30px 0 30px; }

slide-5
SLIDE 5

Box model in Action

5

slide-6
SLIDE 6

Norm rmal l Flo low

  • Browser display of elements in the order they are coded in

the Web page document

Relative Positioning

Changes the location of an element in relation to where it would otherwise appear

h1 { background-color:#cccccc; padding: 5px; color: #000000; } #myContent { position: relative; left: 30px; font-family: Arial,sans-serif; }

Absolute Positioning Precisely specifies the location of an element in the browser window

h1 { background-color: #cccccc; padding: 5px; color: #000000; } #content {position: absolute; left: 200; top: 100; font-family: Arial,sans-serif; width: 300; }

slide-7
SLIDE 7

h1 { background-color:#cccccc; padding:5px; color: #000000; } p { font-family:Arial,sans-serif; } #yls {float:right; margin: 0 0 5px 5px; border: solid; }

float Property

  • Elements that seem to

“float" on the right or left side of either the browser window or another element are

  • ften configured using

the float property.

7

slide-8
SLIDE 8

clear Property

  • Useful to “clear” or

terminate a float

  • Values are left, right,

and both

The h2 text is displayed in normal flow. clear: left; was applied to the h2. Now the h2 text displays AFTER the floated image.

slide-9
SLIDE 9
  • verflow Property
  • Intended to configure the

display of elements on a Web page.

  • However, it is useful to “clear”
  • r terminate a float before the

end of a container element

  • Values are auto, hidden, and

scroll

The background does not extend as far as you’d expect.

  • verflow: auto; was

applied to the div that contains the image and

  • paragraph. Now the

background extends and the h2 text displays AFTER the floated image.

slide-10
SLIDE 10

CSS Page Layout Two Columns (left nav)

slide-11
SLIDE 11

Configure Hyperlinks in an Unordered List

  • Vertical Navigation

<div id="leftcolumn"> <ul> <li><a href="index.html">Home</a></li> <li><a href="menu.html">Menu</a></li> <li><a href="directions.html">Directions</a></li> <li><a href="contact.html">Contact</a></li> </ul> </div>

  • CSS removes the list marker and underline:

11

#leftcolumn ul { list-style-type: none; } #leftcolumn a { text-decoration: none; }

slide-12
SLIDE 12

Configure Hyperlinks in in an Unordered Li List

  • Horizontal Navigation

HTML: <div id="nav"> <ul> <li><a href="index.html">Home</a></li> <li><a href="menu.html">Menu</a></li> <li><a href="directions.html">Directions</a></li> <li><a href="contact.html">Contact</a></li> </ul> </div>

  • CSS removes the list marker, removes the underline, adds padding, and

configures the list items for inline display. #nav ul { list-style-type: none;} #nav a { text-decoration: none; padding-right: 10px; } #nav li { display: inline; }

12

slide-13
SLIDE 13

CSS Pseudo-classes

 Pseudo-classes and the anchor element

  • link – default state

for a hyperlink

  • visited –a hyperlink that

has been visited

  • focus – triggered when

the hyperlink has focus

  • hover – triggered when

the mouse moves over the hyperlink

  • active – triggered when the hyperlink is being clicked

a:link {color:#000066;} a:visited {color:#003366;} a:focus {color:#FF0000;} a:hover {color:#0099CC;} a:active {color:#FF0000;}

slide-14
SLIDE 14

Deciding to Configure a class or id

  • Configure a class:
  • If the style may apply to more than one element on a page
  • Use the . (dot) notation in the style sheet.
  • Use the class attribute in the HTML.
  • Configure an id:
  • If the style is specific to only one element on a page
  • Use the # notation in the style sheet.
  • Use the id attribute in the HTML.

14

slide-15
SLIDE 15

CSS Styling for r Pri rint

  • Create an external style sheet with the configurations

for browser display.

  • Create a second external style sheet with the

configurations for printing.

  • Connect both of the external style sheets to the web

page using two <link > elements.

15

<link rel="stylesheet" href="wildflower.css" type="text/css" media="screen"> <link rel="stylesheet" href="wildflowerprint.css" type="text/css" media="print">

slide-16
SLIDE 16

Pri rint Styling Best Practices

  • Hide non-essential content

Example:

#nav { display: none; }

  • Configure font size and color for printing
  • Use pt font sizes, use dark text color
  • Control page breaks

Example: .newpage { page-break-before: always; }

  • Print URLs for hyperlinks

Example:

#sidebar a:after { content: " (" attr(href) ") "; }

16

slide-17
SLIDE 17

Desig ign Techniques for Mobile Web

 Single column design  Avoid floats, tables, frames  Descriptive page title  Descriptive heading tags  Optimize images  Descriptive alt text for images  Eliminate unneeded images  Navigation in lists  Em or percentage font size units  Common font typefaces  Good contrast between text and background colors  Provide “Skip to Content” hyperlink  Provide “Back to Top” hyperlink

slide-18
SLIDE 18

Viewport Meta Tag

  • Default action for most mobile devices

is to zoom out and scale the web page

  • Viewport Meta Tag
  • Created as an Apple extension to configure

display on mobile devices

  • Configures width and initial scale of browser viewport

<meta name="viewport" content="width=device- width,initial-scale=1.0">

18

slide-19
SLIDE 19

CSS3 Media Queries

  • Media Query
  • Determines the capability of the mobile device, such as

screen resolution

  • Directs the browser to styles configured specifically for

those capabilities

  • Example:

<link href="lighthousemobile.css" rel="stylesheet" media="only screen and (max-device-width: 480px)">

19

slide-20
SLIDE 20

HTML Table Elements

 <table>

Contains the table  <th> Contains a table header element

 <tr>

Contains a table row

 <td>

Contains a table cell

 <caption>

Configures a description of the table

20

slide-21
SLIDE 21

Accessibility and Tables

  • Use table header elements (<th> tags) to indicate column or row

headings.

  • Use the caption element to provide a text title or caption for the

table.

  • Complex tables:

Associate table cell values with their corresponding headers

  • <th> tag id attribute
  • <td> tag headers attribute

21

slide-22
SLIDE 22

<table border="1"> <caption>Bird Sightings</caption> <tr> <th id="name">Name</th> <th id="date">Date</th> </tr> <tr> <td headers="name">Bobolink</td> <td headers="date">5/25/10</td> </tr> <tr> <td headers="name">Upland Sandpiper</td> <td headers="date">6/03/10</td> </tr> </table>

22

slide-23
SLIDE 23

Two Components of f Using Forms

  • 1. The HTML form
  • - the web page user interface

and

  • 2. The server-side processing

Server-side processing works with the form data and sends e-mail, writes to a text file, updates a database, or performs some

  • ther type of processing on the server.

23

slide-24
SLIDE 24

HTML Using Forms

 <form>

Contains the form elements on a web page Container tag

 <input>

Configures a variety of form elements including text boxes, radio buttons, check boxes, and buttons Stand alone tag

 <textarea>

Configures a scrolling text box Container tag

 <select>

Configures a select box (drop down list) Container tag

 <option>

Configures an option in the select box Container tag

24

slide-25
SLIDE 25

Server-Side Processing

 Your web browser requests web pages and their related files from a web server.  The web server locates the files and sends them to your web browser.  The web browser then renders the returned files and displays the requested web pages for you to use.

25

slide-26
SLIDE 26

CGI Common Gateway In Interface

  • A protocol for a web server to pass a web page

user's request to an application program and accept information to send to the user.

26

slide-27
SLIDE 27

Steps in Utilizing Server-Side Processing

  • Web server executes a server-side script.
  • Server-side script accesses requested

database, file, or process.

  • Web server returns web page with

requested information or confirmation of action.

  • Web page invokes server-side processing

by a form or hyperlink.

27

slide-28
SLIDE 28

Common Uses of f Server-Side Scripting

  • Search a database
  • Place an order at an online store
  • Send a web page to a friend
  • Subscribe to a newsletter

28

slide-29
SLIDE 29

Sending information to a Server-side Script

<form method="post" action="http://webdevbasics.net/scripts/demo.php ">

29