HTML and CSS Reference
In-Depth Information
EXPLANATION
(
CONTINUED
)
4
This is another way to use the
onload
property to call a function. An anonymous
function is assigned to onload and will be called after the page has loaded and the
onload
event has been fired.
5
The user-defined function
getToday()
returns the current day of the week.
6
This is the HTML body tag with the
id
attribute. The
id
will be used on line 2 with
the
getElementById()
method to get a reference to this body element.
7
You can see in the display (see Figure 14.34) that the blue border was created for
the document once the page was loaded.
Figure 14.34
Styling the border.
Positioning Text with the
style
Property.
By assigning a position to the
style
prop-
erty it is possible to place an element in different sections of the page. In Example 14.30,
by assigning positions, the text is moved after the document has been loaded.
EXAMPLE
14.30
<html>
<head><title>Positioning</title>
<style type="text/css">
body { background-color: aliceblue;}
div { font-size:larger;
color: white;
border: solid;
border-color:aqua;
}
1
.pos1 {position:absolute; top:50px;left:10px;
background-color:blue;
}