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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

methods of horizontally centering pages? 2

Status
Not open for further replies.

binarybabe

Programmer
May 13, 1999
11
US
hi, all -<br>
<br>
Can anyone share with me their preferred methods of horizontally centering pages? The only surefire way that I have found is to set up "invisible" tables with border=0 and so on, but I hate to go back at this point and do it, if there is a simpler way of accomplishing the same thing. I've experimented with &lt;DIV align="center"&gt; with inconsistent results. Under what circumstances will &lt;DIV&gt; work and not work?<br>
<br>
TIA,<br>
Laurie<br>
aka binarybabe
 
Laurie-<br>
<br>
First off; the "&lt;div&gt;" tag is really meant for "layering" (something used with dynamig HTML) and was never really meant for doing anything like what you're wanting.<br>
What SHOULD work though (and is realatively VERY simple) is that you need to put a &lt;center&gt; tage RIGHT AFTER your &lt;body&gt; tag in all of your pages; then a &lt;/center&gt; tag RIGHT BEFORE the &lt;/body&gt; tag in those pages; this SHOULD center ALL of the information on the page.<br>
Another option, if that doesn't achieve the results you are wanting is this:<br>
*Insert the following tags RIGHT AFTER the &lt;body&gt; tag:<br>
&lt;table width=100% align=center cellspacing=0<br>
cellpadding=0 border=0&gt;&lt;tr&gt;&lt;td align=center border=0<br>
cellpadding=0 cellspacing=0&gt;<br>
*And these tags RIGHT BEFORE the &lt;/body&gt; tag:<br>
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;<br>
<br>
One or the other of these two methods is ALMOST GARUNTEED to achieve the results that you are desiring; please let me know how they work for you.<br>
<br>
<br>
-Robherc<br>
robherc@netzero.net
 
Robherc,<br>
<br>
I tried both methods you listed via copy/paste and they still don't center on my monitor (19"). I kept the pages I used the tags in and I'll check them as soon as I can get to a smaller monitor. Any other ideas? I'm puzzled, as some sites (eg Ebay, who accomplishes the "center" function via table tags) center appropriately on my monitor, others don't. Any ideas why that's the case?<br>
<br>
Thanks for your input -<br>
<br>
Laurie<br>
aka binarybabe<br>
<br>
<br>
<br>

 
Could you send me the HTML code for the pages that you are wanting to center? If I have the code in front of me it is usually easier to both a)see what you're REALLY wanting and b)figure out what may be messing up/what's causing any gliches.<br>
I hope I'll be able to get this to work for you.<br>
One more suggestion before I log off; you might try these tags in the same way as the tags from my previous post:<br>
after the &lt;body&gt; tag:<br>
&lt;center&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;<br>
<br>
before the &lt;/body&gt; tag:<br>
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/center&gt;<br>
<br>
<br>
Hopefully we can get this thing figured out soon!<br>
<br>
<br>
<br>
-Robherc<br>
robherc@netzero.net
 
binarybabe wrote in a message on May 30,1999:<br>
--------------------------------------------------<br>
&gt;Can anyone share with me their preferred methods of <br>
&gt;horizontally centering pages? <br>
<br>
horizontally centering? You mean like you want the text (or image) centered in the middle of the page, like equal distance from top of image to top of page, and bottom of image to bottom of page? I have a javascript (somwhere around here) that does that, if that is what you mean.<br>

 
jvogel,<br>
<br>
Actually, by horizontally centering, I mean that the central content of the page is centered between the left and right screen borders, such that someone with a 14" monitor sees the same effect as a viewer on a 19".<br>
<br>
Thanks,<br>
binarybabe.
 
jvogel-<br>
<br>
I figured out binary's problem; she used MS Drumbeat 2000 & it set up all of her graphics in separate &lt;div&gt; tags with absolute, css, placement....don't know why, but it really messed her up; right now I've suggested that she re-write all of her pages using nested tables instead of the &lt;div&gt; layers.<br>
I say this not to discourage you from responding; just to inform you of the progress that has already been made; PLEASE FEEL FREE to offer any suggestions that you may have...I don't EVER claim to know the ABSOLUTE BEST way of doing anything; there's often a better way, I've just voiced on WORKABLE way.<br>
<br>
<br>
<br>
-Robherc<br>
robherc@netzero.net
 
I agree with robherc. I would add to his advise, set the width of your overall table to 100% and add align="center" inside of your &lt;td&gt; tags if necessary.<br>
rivkah
 
This is how I do it.<br>
<br>
&lt;table align="center" width="100%"&gt;<br>
&lt;tr&gt;<br>
&lt;td align="center"&gt;<br>
&lt;table &gt;<br>
&lt;tr&gt;<br>
&lt;td&gt;&lt;/td&gt;<br>
&lt;/tr&gt;<br>
&lt;/table&gt;<br>
&lt;/td&gt;<br>
&lt;/tr&gt;<br>
&lt;/table&gt;
 
I am using the Hotdog25 editor.<br>
My problem: At one time when I saved a web page in Hotdog25 it would add<br>
the extension .html. Meaning when I uploaded to my web site all pages<br>
would have the extension .html.<br>
Here of late when I upload to the web page ALL new up-loads would be .htm.<br>
(note, it does not add the L on htm.<br>
What can I do to get it to upload in html?<br>
I am using Cute as an ftp and I have checked every thing I can find in<br>
both programs.<br>
Help<br>

 
Check my response in the thread you started if you have'nt already, but also: try going through MS Explorer after you save your files for uploading them....this may solve your problem temporarily.<br>
<br>
<br>
-Robherc<br>
robherc@netzero.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top