|
|
A c t i o n f o r L i b r a r i e s
— M a y 2 0 0 2
The Internet ConnectionBy Michael SauersAdding a Footer to a Two-column Web Layout Here's our code thus far: CSS
XHTML (HTML) Tags To add a footer, we must first create a new <div> with the content of the footer. This <div> is placed in the XHTML/HTML code after the right column.
<div> (You can create a class to apply to this <div> to modify it as needed, such as changing the font size or alignment.) This does the job, but there is one potential problem. What if the content of the left column is longer than the right column? In that case, we get the result shown below. See Figure 1. Our <hr> (or footer line) is lost up near the top of the page (to the left of the right column content) and the footer text itself has become part of the right column. What we want is for the footer to appear beneath both columns. | |
Figure 1
|
Figure 2
|
|
To accomplish this, we need to add a line break that will instruct the following content (our footer <div>) to appear below both columns. This is done by adding the following XHTML/HTML code before our footer <div>: <br clear="all" />This instructs the browser to issue a line-break, but not to display the next content until all margins can be reached. (We could have used clear="left" in this case but by using all, we don't need to keep track of which column is longer.) See Figure 2. Next Article | Previous Article | Table of Contents | BCR Publications Comments to:
shoffhin@bcr.org |
|