Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

My page content won't center 1

Status
Not open for further replies.

naiku

Technical User
Apr 25, 2002
346
US
Hey All

For some reason I can't get the content of my page to center, I have put all of the content inside a table with 100% width and then centered the content in that table. However when I view in IE it's all shifted to the left, yet when I open the page in Dreamweaver it's in the center. I have posted the code below, can someone tell me what I am missing? The annoying part is I get the feeling its something really simple, one of those things thats easily overlooked or something along those lines.

Thanks

Code:
<body background=&quot;assets/images/center_cloud.jpg&quot; bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
<table width=&quot;718&quot;>
  <tr>
    <td width=&quot;708&quot; align &quot;center&quot;>
<table width=&quot;710&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
        <tr> 
          <td width=&quot;112&quot; height=&quot;32&quot;> </td>
          <td width=&quot;598&quot; valign=&quot;top&quot;><strong><font size=&quot;-1&quot; face=&quot;Arial, Helvetica, sans-serif&quot;>If 
            you would like us to contact you regarding any issues with air conditioning, 
            please complete the form below and we will contact you as soon as 
            possible. </font></strong></td>
          </tr>
      </table>
<form name=&quot;air_form&quot; action=&quot;/cgi-bin/form/form.pl&quot; method=&quot;POST&quot;>
<input type=&quot;hidden&quot; name=&quot;email&quot; value=&quot;form@mysite.co.uk&quot;>
<input type=&quot;hidden&quot; name=&quot;realname&quot; value=&quot;my_site&quot;>
<input type=&quot;hidden&quot; name=&quot;recipient&quot; value=&quot;it@mysite.co.uk&quot;>
<input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;[URL unfurl="true"]http://www.mysite.ltd.uk/thankyou_page.html&quot;>[/URL]
        <table width=&quot;488&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;><!--DWLayoutTable-->
          <tr> 
            <td width=&quot;135&quot; height=&quot;24&quot; valign=&quot;middle&quot;> <strong><font size=&quot;-1&quot; face=&quot;Arial, Helvetica, sans-serif&quot;>Title: 
              </font></strong></td>
            <td colspan=&quot;2&quot; valign=&quot;top&quot;> <select name=&quot;s_unfav&quot;>
                <option value=&quot;Mr&quot;>Mr</option>
                <option value=&quot;Mrs&quot;>Mrs</option>
                <option value=&quot;Miss&quot;>Miss</option>
                <option value=&quot;Ms&quot;>Ms</option>
                <option value=&quot;Dr&quot;>Dr</option>
              </select> </td>
            <td width=&quot;53&quot;> </td>
          </tr>
          <tr> 
            <td rowspan=&quot;2&quot; valign=&quot;middle&quot;> <font size=&quot;-1&quot;><strong>Name: </strong></font></td>
            <td height=&quot;22&quot; colspan=&quot;2&quot; valign=&quot;top&quot;> <input name=&quot;name&quot; type=text size=&quot;30&quot; maxlength=&quot;40&quot;> 
            </td>
            <td> </td>
          </tr>
          <tr> 
            <td colspan=&quot;2&quot; rowspan=&quot;2&quot; valign=&quot;top&quot;> <input name=&quot;Email&quot; type=text size=&quot;30&quot; maxlength=&quot;40&quot;> 
            </td>
            <td height=&quot;2&quot;></td>
          </tr>
          <tr> 
            <td height=&quot;20&quot; valign=&quot;middle&quot;> <strong><font size=&quot;-1&quot;>Email: </font></strong></td>
            <td></td>
          </tr>
          <tr> 
            <td height=&quot;22&quot; valign=&quot;middle&quot;> <font size=&quot;-1&quot;><strong>Street Address: 
              </strong></font></td>
            <td colspan=&quot;2&quot; valign=&quot;top&quot;> <input name=&quot;street&quot; type=text size=&quot;50&quot; maxlength=&quot;75&quot;> 
            </td>
            <td></td>
          </tr>
          <tr> 
            <td height=&quot;22&quot; valign=&quot;middle&quot;> <font size=&quot;-1&quot;><strong>Town: </strong></font></td>
            <td colspan=&quot;2&quot; valign=&quot;top&quot;> <input name=&quot;town&quot; type=text size=&quot;50&quot; maxlength=&quot;75&quot;> 
            </td>
            <td></td>
          </tr>
          <tr> 
            <td height=&quot;22&quot; valign=&quot;middle&quot;> <strong><font size=&quot;-1&quot;>County: </font></strong></td>
            <td colspan=&quot;2&quot; valign=&quot;top&quot;> <input name=&quot;county&quot; type=text size=&quot;30&quot; maxlength=&quot;45&quot;> 
            </td>
            <td></td>
          </tr>
          <tr> 
            <td height=&quot;22&quot; valign=&quot;middle&quot;> <strong><font size=&quot;-1&quot;>Postcode: 
              </font></strong></td>
            <td colspan=&quot;2&quot; valign=&quot;top&quot;> <input name=&quot;postcode&quot; type=text size=&quot;25&quot; maxlength=&quot;25&quot;> 
            </td>
            <td></td>
          </tr>
          <tr> 
            <td height=&quot;22&quot; valign=&quot;middle&quot;> <strong><font size=&quot;-1&quot;>Telephone: 
              </font></strong></td>
            <td colspan=&quot;2&quot; valign=&quot;top&quot;> <input name=&quot;telephone&quot; type=text size=&quot;25&quot; maxlength=&quot;25&quot;> 
            </td>
            <td></td>
          </tr>
          <tr> 
            <td height=&quot;14&quot;></td>
            <td width=&quot;278&quot;></td>
            <td width=&quot;22&quot;></td>
            <td></td>
          </tr>
          <tr> 
            <td height=&quot;61&quot;></td>
            <td valign=&quot;top&quot;> <p> 
                <label> 
                <input type=&quot;radio&quot; name=&quot;query_type&quot; value=&quot;radio&quot;>
                <font size=&quot;-1&quot;><strong>New Air Conditioning</strong></font></label>
                <br>
                <label> 
                <input type=&quot;radio&quot; name=&quot;query_type&quot; value=&quot;radio&quot;>
                <strong><font size=&quot;-1&quot;>Maintenance of existing equipment</font></strong></label>
                <br>
                <label> 
                <input type=&quot;radio&quot; name=&quot;query_type&quot; value=&quot;radio&quot;>
                <strong><font size=&quot;-1&quot;>Other (Please enter details below)</font></strong></label>
                <br>
              </p></td>
            <td></td>
            <td></td>
          </tr>
          <tr> 
            <td height=&quot;14&quot;></td>
            <td></td>
            <td></td>
            <td></td>
          </tr>
          <tr> 
            <td height=&quot;18&quot; colspan=&quot;4&quot; valign=&quot;top&quot;> <font size=&quot;-1&quot;><strong>Please 
              enter any extra details below </strong></font></td>
          </tr>
          <tr> 
            <td height=&quot;120&quot; colspan=&quot;4&quot; valign=&quot;top&quot;> <textarea name=&quot;information&quot; cols=&quot;75&quot; rows=&quot;5&quot;></textarea> 
            </td>
          </tr>
          <tr> 
            <td height=&quot;17&quot;></td>
            <td></td>
            <td></td>
            <td></td>
          </tr>
          <tr> 
            <td height=&quot;24&quot; colspan=&quot;4&quot; align=&quot;center&quot; valign=&quot;top&quot;><input name=&quot;Submit&quot; type=Submit value=&quot;Submit Form&quot;> 
              <input type=&quot;reset&quot; name=&quot;Submit2&quot; value=&quot;Clear Form&quot;></td>
          </tr>
        </table>
</form>
</td>
</tr>
</table>  
</body>
 
Just place everything inside <center> </center> tags.

 
Thanks :) Another thing I have just noticed, when I click the submit button I am not taken to my Thankyou page, instead it tries to open the form.pl file.

How do I fix that? I thought all I needed to do was put the redirect tag on the page which I had. Can you tell it's my first form page?

Thanks again for replies already

Naiku
 
To your table tags don't forget to specify summary=&quot;&quot; and also its useful to specify cellpadding and cellspacing (you have done this in the 2nd table).

On your main table maybe you should make the width 100% instead of 718?

Why do you have:
<td width=&quot;708&quot; align &quot;center&quot;>
<table width=&quot;710&quot;> ?
maybe make the nested table width=&quot;100%&quot;

<strong><font size=&quot;-1&quot; face=&quot;Arial, Helvetica, sans-serif&quot;>
This is old stuff! :)
Move onto CSS.

Instead of the above (and in all instances where you used the above type codes) try::

<head>
<style type=&quot;text/css&quot;>
<!--
p.mypara {
font-family:Arial, Helvetica, sans-serif;
font-size: 10pt;
font-weight: bold; }
-->
</style>
</head>

<body>
<p class=&quot;mypara&quot;>If you would like us to contact you regarding..</p>

If you dont want to use paragraphs <p> you could use <div> or <span> and apply the same styles to these.



É

endamcg-logo1b.gif

 
I am using CSS for the rest of the page, but for some reason it does not have any effect on my table. I am guessing that maybe there is a seperate part I should use on the CSS sheet to affect the table.

Thanks for the pointers :)
 
Hi,
it depends what you want to do to the table??

For every text it should be enclosed in something like <p> <h1> - <h6>, <span> <div> and the styles are applied to this.

For your tables it works the same
<style type=&quot;text/css&quot;>
<!--
table.maintbl {border: solid 1px red} etc
table.footer {etc}
-->
</style>

<table class=&quot;maintbl&quot;>
<table class=&quot;footer&quot;>

Same with text fields etc



É

endamcg-logo1b.gif

 
Thanks for that, I changed my external CSS sheet and now the tables are fine :)

Now to just sort that redirect....
 
It does not re-direct, when I click the Submit button it just loads a blank page. The form works fine, I have had the emails back from a test one I tried, but it does not re-direct to the &quot;thankyou&quot; page.
 
Once the re-direct page is right it should re-direct ok. Your code is fine anyway.
Is the re-direct page in the same directory? Try a relative link instead of absolute, it shouldn't make any difference that i see but they can be funny sometimes!
Is there anything within form.pl which specifies a redirect?


É

endamcg-logo1b.gif

 
I tried a relative link but it gave the same result, can't find anything in the form.pl except for
Code:
# Return HTML Page or Redirect User
&return_html;

Do I need to change that to redirect? If it helps the script I am using is from
I can't find anything in the readme file that came with it.
 
Are you using the latest version of the script? There was a bug in previous versions which caused problems with redirection.

You didnt change anything within the script did you?


É

endamcg-logo1b.gif

 
Yeah I have the latest version, and I have not changed anything with it. Would not know what I was changing :p

 
Thanks for all the help, I have (somehow) fixed it though. All I did was delete the files from my webspace and upload them again.

Wish I could say exactly what I did, but all appears fine now....darn that's gonna bug me since I want to know what was causing it not to work.

Thanks again

Naiku
 
Yeah it's very annoying not knowing what it was, especially if I ever come across the same problem again. Ah well it's working can't ask for more than that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top