HTML and CSS Reference
In-Depth Information
here is another important diference. he select element without the
multiple attribute always returns a value that, by default, is the irst option
item. he select element with the multiple attribute does not return a value if
the user does not leave any of the options selected when the form is submitted.
To override this behavior, the selected attribute can be added to any option
element. For example:
<option value="quakes" selected> Quakes </option>
The HTML5 Canvas
he canvas element is one of HTML5's most exciting new additions. As the
name implies, the canvas element creates a rectangular drawing surface on a
web page with a height and width given by the value of the height and width
attributes. he canvas element is a block element. Its content is fallback mate-
rial for browsers and other user agents that do not support the canvas element.
he fallback content should not contain other block elements but may contain
images and other inline markup.
<canvas id="c1" width="360" height="360">
Sadly, your browser doesn't support the <em> canvas </em> element.
What happens on the canvas is controlled by scripts. he canvas applica-
tion programming interface (API) provides several dozen methods or func-
tions for drawing lines, arcs, and rectangles; illing areas with patterns and
colors; writing stylized text; manipulating images and video; and other fun
activities. Covering all of this would take a book in itself, but we can look at a
quick example to see how canvases work. Example 2.27 has a 400-by-400-pixel
canvas element upon which the user can draw smaller squares of diferent
colors by clicking various buttons.
Example 2.27: HTML code for using the canvas element
<!DOCTYPE html>
<title>Example 2.27</title>
Search WWH ::

Custom Search