Solved

Align table to top of web page

Posted on 2009-04-02
5
2,011 Views
Last Modified: 2012-05-06
I am trying to align a table to the top of the page.  Currently part of the body background is showing above the table, which we want to eliminnate.

We have tried numerous html and css solutions, but have not got it to work.

I've included the html code and css code below.

Thanks!
html code:
<body BGCOLOR="#C6D3F4" LEFTMARGIN="0" TOPMARGIN="0" RIGHTMARGIN="0" BOTTOMMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="5" background="/images/left-shadow-background.jpg"></td>
        <td><table width="750" border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff" align="center">
  <tr>
    <td align="center" valign="top"><img src="/images/header.jpg" width="750" height="155" /></td>
  </tr>
  <tr>
    <td align="center" valign="top"><!-- InstanceBeginEditable name="content" -->
<table width="750" border="0" align="center">
  <tr align="center" valign="top"> 
    <td> 
      <p class="title">&nbsp;</p>
      <p class="center-paragraph">Welcome to our new website!<br />
      Under Construction</span></p>
      <table width="750" border="0">
        <tr>
          <td align="center" valign="top"><p class="center-paragraph">13540 N. Florida Avenue, Suite 206B<br />
            Tampa, Florida 33613<br />
            Phone: 813-264-2954<br />
            Fax: 813-265-1862</p>
            <p class="paragraph-center-black">&nbsp;</p></td>
        </tr>
      </table>
      <p>&nbsp;</p>
      <p class="center-paragraph"><a href="index.htm" class="c">Home</a> | <a href="contact/index.htm" class="c">Contact</a></span></p>
      <p>&nbsp;</p>
    </td>
  </tr>
</table>
<!-- InstanceEndEditable --></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table></td>
        <td width="5" background="/images/right-shadow-background .jpg"></td>
      </tr>
      <tr>
        <td height="50" colspan="3" valign="top" background="/images/bottom-shadow-background.jpg"></td>
        </tr>
    </table></td>
  </tr>
</table>
</body>
 
------------------------------------------------------------
 
css code:
a.c:link { color:#0000FF; }
a.c:visited {color:#0000FF; }
a.c:hover { color:#BF414C; }
 
a.n:link { color:#FFF; }
a.n:visited {color:#FFF; }
a.n:hover { color:#C6D9EC; }
 
a.bc:link { color:#BF414C; }
a.bc:visited {color:#BF414C; }
a.bc:hover { color:#BF414C; }
 
body {
	background-color: #C6D3F4;
	font-family:calibri;
	margin: 0;
	padding: 0;
	position: absolute; top: 0; left: 0; right: 0; bottom: 0;
}
p {
	font-family:calibri;
	font-size:12pt;
	font-style:normal;
	font-weight:100;
	letter-spacing:normal;
	line-height:14pt;
	color: #000;
	text-align: left;
}
.center-paragraph {
	font-family:calibri;
	font-size:12pt;
	font-style:normal;
	font-weight:100;
	letter-spacing:normal;
	line-height:14pt;
	color: #000;
	text-align: center;
}

Open in new window

0
Comment
Question by:allanmcnabb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 14

Expert Comment

by:ziffgone
ID: 24050571
Can't seem to replicate your problem. I took your code and viewed it in Firefox and IE and the Table aligns perfectly the top of the page.

Are you viewing the page in an editor or directly in a browser?

Try clearing your Cache (Temp Internet Files) between each view.

Regards...
0
 

Author Comment

by:allanmcnabb
ID: 24053923
Thanks.  I made sure I was getting a fresh page by adding text to the index file.

I still get part of the blue background above the table.  We are trying to have the table at the very top, in which case you would not see any of the blue background.

Can you help?  We want to align the table at the top, such as with http://brantleynurseries.com/.

Thanks!
0
 

Accepted Solution

by:
allanmcnabb earned 0 total points
ID: 24054343
Thanks for your help!

I found a solution.

I put
     <DIV style="position:absolute;top:0px">
before the top table.  And I put
    </DIV>
at the end of the table.

0
 
LVL 13

Expert Comment

by:qwerty021600
ID: 24056935
I checked you code.. It's working perfectly fine on all the browsers.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Change how page is organized 3 51
CSS for <center> 14 49
CSS question 4 57
iframe stay to the left of page 5 30
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question