HTML and CSS Reference
In-Depth Information
better than fewer, larger ones when youre developing applications. By the way, when doing your own
programming, dont forget to put comments in the code as described in Chapter 2. And add blank lines to
make the code more readable. Table 3-2 shows the code for the basic bouncing ball application and
explains what each line does.
Table 3-2.
The Bouncing Ball Application
Code
Explanation
<html>
Start
html
<head>
Start
head
<title>Bouncing Ball
with inputs</title>
Complete
title
element
Start
style
<style>
form {
Start form styling
width:330px;
Set up
width
margin:20px;
Set
margin
background-color:brown;
Set
color
padding:20px;
Set internal
padding
}
Close this style
</style>
Close style element
<script type="text/javascript">
Start
script
element. (The type is not required. I
show it here just to let you know what youll see in
many examples online.)
var boxx = 20;
x location of upper corner of box
var boxy = 30;
y location of upper corner of box
var boxwidth = 350;
Box width
var boxheight = 250;
Box height
var ballrad = 10;
Radius of ball