After the header has been developed, the form is added to the page. For now, only the display of the form will be presented to make the concepts clearer. Later, this chapter will show how CSS can be used with JavaScript to control display of the form.
If the form is simply added to the page, as shown below, it looks very unprofessional. While it is functional, it is ugly and would not inspire confidence from the users that the web page actually works.
A much nicer layout of the form follows. The following is the form display that will be styled using CSS. Following the form, the CSS and HTML are presented here and an explanation of all the elements is given.
The CSS for the head has been defined, and that leaves just 4 CSS tags to cover here. The first are the #form and #map id tags. These two tags create boxes displayed on the web page to contain other form elements. The #form is 20% of the size of the page, and the #map is 67% the size of the page and is anchored to the right of the page using the float:right attribute. The inline:block attribute tells CSS to put both on the same line. Since they only take up 87% of the line, 13% of the line will not be included in either division and left blank between the two pages. Both or the div sections have black boarder 2 pixels in size, and both will take up 70% of the height of the page, with the rest used by the header. Finally, the padding says leave some room on the right and left of the divisions before rendering the text.
The final two tags, the input:-moz-read-only and input:read-only tags, are to gray out any input tags which are read only, e.g. the value for these input fields cannot be typed in by the user and must be set programmatically. These are the read only fields on the map for latitude and longitude.
HTML
Program 82 – CSS with form completed example.
<html>
<head>
<title>Map Example Input Screen </title>
<link rel="stylesheet" type="text/css" href="WebMapExample.css">
</head>
<body>
<div class="header-icon">
<image src="GRI_logo.png" />
</div>
<div class="header-desc">
<h1>Map Example</h1>
<p class="header-p">
Example map input screen
</p>
</div>
<div class="header-menu">
<p class="header-p">
Home File About
</p>
</div>
</header>
<section />
<label for="creationDate">Creation Date
</label>
<input type="date" />
</p>
<input type="button" value="Process Form" />
</section>
<section >
<h1> This is where the map will go </h1>
</section>
</body>
</html>
For the HTML for the page, the only change was to add two section tags to create sections for the form and the map. The section tag is a div tag that has a semantic meaning. A section to a for is a completely separate part of the form. A division has no semantic meaning.