It is important to use embedded styles for alignment since the center element and the align attribute (except when used in td and th) are deprecated.
Text and images can be left, right or center aligned.
The alignCenter, alignLeft and alignRight CSS classes have already been defined in the GC CLF 2.0 template. If you are not using the GC CLF 2.0 template, you will have to define the following CSS classes:
.alignCenter{text-align: center;}.alignLeft{text-align: left;}.alignRight{text-align: right;}Surround the text and/or images with one of the following:
<p class="alignCenter"></p><form> and </form>)<div class="alignCenter"></div><h1 class="alignCenter"></h1><h2 class="alignCenter"></h2><h3 class="alignCenter"></h3><h4 class="alignCenter"></h4><h5 class="alignCenter"></h5><h6 class="alignCenter"></h6>For left or right alignment, use alignLeft or alignRight instead of alignCenter.
Do not use <p> or </p> between <form> and </form> since there is a bug in Netscape 4.x that will cause the form engine to shut down.
<p class="alignCenter">This text is centre aligned.</p>This text is centre aligned.
<div class="alignRight">This text is right aligned.</div><p class="alignCenter"><img src="images/wmms.gif" height="20" width="83" alt="Symbol of the Government of Canada" /></p>![]()
<p class="alignRight"><img src="images/wmms.gif" height="20" width="83" alt="Symbol of the Government of Canada" /></p>![]()
Aligning form controls is almost the same as aligning text and images, with the following exceptions:
div element (the p element causes problems in Netscape 4.x). div that uses a style for alignment. This is required because of a bug in Netscape 6.0. Caution: Do not use <p> or </p> between <form> and </form> since there is a bug in Netscape 4.x that will cause the form engine to shut down.
To vertically align the label with the form control, use either the alignTop or alignBottom CSS class with the label. If the form control is being horizontally aligned as well, then use either the alignTopLeft or alignBottomLeft CSS class with the label.
The alignTop, alignBottom, alignTopLeft and alignBottomLeft CSS classes have already been defined in the GC CLF 2.0 template. If you are not using the GC CLF 2.0 template, you will need to define the following CSS classes:
.alignTop{vertical-align: top;}.alignBottom{vertical-align: bottom;}.alignTopLeft{text-align: left; vertical-align: top;}.alignBottomLeft{text-align: left; vertical-align: bottom;}Note: The alignTop and alignTopLeft CSS classes will vertically align the label with the top of the form control. The alignBottom and alignBottomLeft CSS classes will vertically align the label with the bottom (default) of the form control.
<div>
<label class="alignTopLeft" for="comments4">
<strong>Comments</strong></label>
<textarea name="comments4" id="comments4" rows="5" cols="30">
</textarea>
</div>
The alignCenter, alignLeft, alignRight, alignTopLeft and alignBottomLeft CSS classes have already been defined in the GC CLF 2.0 template. If you are not using the GC CLF 2.0 template, you will need to define the following CSS classes:
.alignCenter{text-align: center;}.alignLeft{text-align: left;}.alignRight{text-align: right;}.alignTopLeft{text-align: left; vertical-align: top;}.alignBottomLeft{text-align: left; vertical-align: bottom;}Surround the form controls with <div class="alignCenter"></div>.
For left or right alignment of any form control, use alignLeft or alignRight instead of alignCenter.
The associated label element must always use either the alignBottomLeft or the alignTopLeft CSS class as shown below:
<div class="alignCenter"><label class="alignTopLeft" for="email3"><strong>Email Address</strong></label>
<input name="email3" id="email3" size="30" maxlength="30" /></div>
Note: The alignTopLeft CSS class will vertically align the label with the top of the form control. The lignBottomLeft CSS class will vertically align the label with the bottom (default) of the form control.
<div class="alignCenter"><label class="alignTopLeft" for="email">
<strong>Email Address</strong></label></div>
<div class="alignCenter"><input name="email" id="email" size="30" maxlength="30" /></div>
<div class="alignCenter"><label class="alignTopLeft" for="email2"><strong>Email Address</strong></label>
<input name="email2" id="email2" size="30" maxlength="30" /></div>
There are accessibility issues with radio buttons. The select form
control must be used instead. Read Replacing
Radio Buttons with Selects for more details.
<div class="alignCenter">
<fieldset>
<legend>Preferred colour </legend>
<input type="checkbox" name="check1" id="check1" value="Red" />
<label class="alignTopLeft" for="check1">Red</label><br />
<label class="alignTopLeft" for="check2">White</label>
<input type="checkbox" name="check2" id="check2" value="White" />
</fieldset></div>
<div class="alignCenter">
<label class="alignTopLeft" for="comments">
<strong>Comments</strong></label></div>
<div class="alignCenter">
<textarea name="comments" id="comments" rows="5" cols="30"></textarea></div>
<div class="alignCenter">
<label class="alignTopLeft" for="comments2">
<strong>Comments</strong></label>
<textarea name="comments2" id="comments2" rows="5" cols="30"></textarea></div>
<div class="alignCenter">
<label class="alignTopLeft" for="prov">
<strong>You live in </strong></label></div>
<div class="alignCenter"><select name="prov" id="prov">
<option value="" selected="selected"></option>
<option value="AB">Alberta</option>
<option value="BC">British Columbia</option>
<option value="MB">Manitoba</option>
<option value="Other">Other</option>
</select></div>
<div class="alignCenter">
<label class="alignTopLeft" for="prov2">
<strong>You live in </strong></label>
<select name="prov2" id="prov2">
<option value="" selected="selected"></option>
<option value="AB">Alberta</option>
<option value="BC">British Columbia</option>
<option value="MB">Manitoba</option>
<option value="Other">Other</option>
</select></div>
<div class="alignCenter">
<input type="submit" value="Submit" />
<input type="reset" value="Clear" /></div>