| Centering an Image on a Page: |
|
(beginner) |
|
|
|
The default placement for content on a web page is to the left and at
the top: the <center> tag or center alignment of elements allows
you to place content in the center horizontally: but it's still at the
top of the page. If you want to make sure that your image appears right
in the center of the page, no matter what your monitor size or resolutlion,
place the image into a table sized to 100% in width as
well as in height. That table will contain a single row and a single
cell; align the content of the cell to the center and valign it to the
middle: your image will always be right in the center of the screen.
Example and code:
<HTML>
<HEAD>
<TITLE>Centered Image</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000"
LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0"
MARGINHEIGHT="0">
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0"
CELLPADDING="0" HEIGHT="100%">
<TR>
<TD ALIGN="CENTER" VALIGN="MIDDLE"><IMG
SRC="yourimagehere.gif" WIDTH="104" HEIGHT="102"></TD>
</TR>
</TABLE>
</BODY>
</HTML>
|
|