Professional Documents
Culture Documents
Chapter 5:
Data cells are marked with the td element and are used for any
content that is not considered a heading
To add a border to a Web table using HTML, use the border attribute
<table border="value"> ... </table>
where value is the size of the border in pixels
A spanning cell is a single cell that occupies more than one row or
one column in the table
To create a table cell that spans several columns, add the attribute
colspan=columns"
to the cell, where columns is the number of columns covered by the
cell
To create a table cell that spans several rows, add the attribute
rowspan=rows"
to the cell, where rows is the number of rows covered by the cell
To create a table caption, add the caption element directly below the
opening <table> tag with the syntax
<caption>content</caption>
where content is the content of the table caption
The amount of space between table cells is known as the cell spacing
The cell padding is the space between the cell contents and the cell
border
To define the space between table cells, add the cellspacing attribute
To define the padding within table cells, add the cellpadding attribute
To set the width of the table to a specific value, add the width attribute
<table width="value"> ... </table>
You can use HTML to set the row heights by applying the height
attribute
<tr height="value"> ... </tr>
A table frame specifies which sides of the table (or which sides of the
table cells) will have borders
<table border="value" frame="type"> ... </table>
A table rule specifies how the internal gridlines are drawn within the
table
<table border="value" rules="type"> ... </table>
TABLE CSS
To define the border model used by the table, apply the table style
border-collapse: type
where type is separate (the default) to keep all borders around cells
and the table itself apart, or collapse to merge all adjacent borders
To set the space between separated borders, apply the table style
border-spacing: value
where value is the space between the borders in any of the CSS units
of measure
caption-side: position
where position is top or bottom
where width is the width of the columns expressed in one of the CSS units of
measure or as a percentage of the width of the element
For specific browsers, add the -moz- vendor prefix for Firefox and the
webkit prefix for Safari and Chrome to these style properties.
CHAPTER 6
<form attributes>
content
</form>
Where attributes are the attributes that control how the form is
processed and content is the content of the form.
Where id is the id of the form and name is the name of the form.
HTML and XHTML allow you to organize a form into a group of fields
called field sets.
<fieldset id=id>
controls
</fieldset>
where id identifies the field set and controls are the control elements
associated with fields within the field set
To add a legend to a field set, add the following tag after the opening
<fieldset> tag:
<legend>text</legend>
Where text is the text of the field set caption.
Where type specifies the type of input control, and the name and id
attributes provide the controls name and id.
Starting with HTML5, you can also populate your input boxes with
placeholders. A placeholder is a text string that appears within the
control element and provides users with information about the kind of
information accepted by the field
A selection list is a list box from which a user selects a particular field
value or set of field values.
Selection lists are useful when there are a fixed set of possible
responses from the user.
You can specify each individual selection item using the <option> element.
You can change the number of options displayed in the selection list by
modifying the size attribute. The syntax is as follows:
Where the name attribute identifies the check box controls and the
value attribute specifies the value sent to the server if the check box is
selected.
To create a spinner control for numeric data, enter the input element
To create a range slider control for numeric data, use the following
input element:
Submit buttons submit forms to the server for processing when clicked.
Syntax is as follows:
<input type=submit value=text />
Use the button element for greater artistic control over the appearance
of a button.
To validate that a text input box follows a character pattern, add the
attribute pattern=regex
One disadvantage with the current validation checks is that they all
occur after a user has completed and submitted the form
CHAPTER 7
There are different sound file formats used for different operating
systems.
Different file formats provide varying levels of sound quality and file
compression.
</audio>
where url1, url2, etc. are the possible sources of the audio clip.
Older browsers that dont support the HTML5 audio element instead
rely on plug-ins to play embedded media clips
To insert an embedded object such as a media player, you can nest the
embed element within the audio element
<audio src=overture.mp3>
<embed src=overture.mp3
width=250 height=10
type=audio/mpeg
/>
</audio>
The src, type, height, and width attributes constitute the basic HTML
attributes for the embed element, but they do not specify how users
interact with the embedded object
The video bit rate, which is the amount of data that has to be
processed by the video player each second
</video>
type=application/x-shockwavewidth=value
height=value>
flash
where url is the location and filename of the SWF file, and parameters
is other parameter elements that manage the appearance and actions
of the player
type=application/x-shockwave-flash width=value
height=value parameters />
</object>
CHAPTER 8
where color is the color of the shadow, offsetX and offsetY are the
displacements of the shadow from the text in the horizontal and vertical
directions, and blur is the size of the blurring effect.
where the optional inset keyword places the shadow within the object,
and the optional spread value increases or decreases the size of the shadow
relative to the size of the object.
where position is the starting point of the gradient using the keywords
left, right, top, and bottom; angle is the angle of the gradient; and color-stop
is the position and color of each color (entered as color position).
where center is the position of the radial gradients center, shape is the
gradients shape, size is the size of the gradient, color is the initial color at
the center, and color-stop is a color and its position within the radial
gradient.
where url is the source of the border image file, slice is the size of the
slice cut from the border image file, and repeat indicates whether the border
slices should be stretched to cover the objects four sides or tiled
transparent) up to 1
transparent) up to 100
To create a style sheet for a specific media device, add the attribute
media = devices
to either the link element or the style element, where devices is one or
more of braille, embossed, handheld, print, projection, screen, speech, tty,
tv, or all. If you dont specify a media device, the style sheet applies to all
devices. Multiple media types should be entered in a comma-separated list
To create a style for specific media from within a style sheet, add the
rule
@media devices {styles}
where styles is the style rules that are applied to the different page
elements displayed by those media devices
To define a page box for a printout that indicates the page size,
margins, and orientation, use the style rule
@page {styles}
where styles is the styles that define the page.
To set the page size and orientation, use the style property
size: width height orientation;
where width and height are the width and height of the page, and
orientation is the orientation of the page (portrait or landscape).
To create a media query for loading a style sheet, add the media
attribute
media = devices and|or (features)
To associate a style sheet with screen devices that are less than or
equal to a specific width, use the query
media = screen and (max-width: value)
where value is the maximum allowable width of the screens viewport
To associate a style sheet with screen devices that are greater than or
equal to a specific width, use the query
media = screen and (min-width: value)
where value is the minimum allowable width of the screens viewport.
To associate a style sheet with screen devices that fall within a range
of screen widths, use the following query:
media = screen and (min-width: value and max-width: value)
Chapter 9
HTML
Standards get confusing among browsers
Can be applied inconsistently
The DTD used depends on the content of the document and the needs
of your users
To support old browsers in a framed Web site, use the frameset DTD
applet
basefont
center
dir
font
isindex
menu
noframes
strike
Validate website
<root xmlns=namespace>
To set XHTML as the default namespace for a document, add the xmlns
attribute to the html element with the following value:
<html xmlns=http://www.w3.org/1999/xhtml>
The rules for HTML5 are much more open than for XHTML
Chapter 10
JAVA
Server-side programs are placed on the server that hosts a Web site
Can be problematic
Insert a client-side script in a Web page when using the script element
<script type="mime-type">
script commands
</script>
<script type=mime-type>
script commands
</script>
<script type=mime-type>
script commands
</script>
document.write(text);
where text is the HTML code to be written to the Web page
The + symbol used in this command combines several text strings into
a single text string
var variable;
where variable is the name assigned to the variable.
Boolean values
Null values
The + symbol can be used with either numeric values or text strings
var total = 5 + 4;
var emLink = "cadler" + "@" + "mpl.gov";
to the Web page, where url is the URL of the external document and
mime-type is the language of the code in the external script file.