NEW centering thread

S

Spike

==================================
Centering Publisher built Web Sites pages:
Version 2009-001
Added inch to pixel conversion
==================================

Edit the htm file(s) and replace </head> with

</head><table border="0" cellpadding="0" cellspacing="2"
width="760"align="center"><tr><td>

" All above on one line "

Be sure that you edit the </head> line and NOT the <head> line

If you are using a page width different than 760 pixels change that number
in the above line
If you are using inches for measurement multiply the width in inches by 96
and use that number

If you have multiple pages you might want to look at
http://www.emurasoft.com/replall/ a simple replace lines in multiple htm
files


Setup the Replace in files program

Find: = </head>

Replace with: = </head><table border="0" cellpadding="0" cellspacing="2"
width="760"align="center"><tr><td>

File Types: = *.htm or *.html (what ever one you are using)

In Folder: = Select the folder where you published the htm / html files

Check the Replace In Subfolders box

The settings will remain until you change them


Then after running the repalce in files program (Replace All) ftp the files
to your server


Spike
 
E

Eric James

This 'solution' needs to come with an attached health warning.
A few minutes spent learning a little html coding should teach you that
editing your web pages in the manner suggested will result in fundamentally
invalid html documents containing a gross syntax error comprising of an
incomplete statement in an invalid position. It could hardly be much worse.
The fact that this appears to work relies upon the current versions of
mainstream browsers being suitably flexible in rendering erroneous code.
There is no guarantee they will be so accommodating in future versions, and
it would be perfectly valid for a browser to simply display an error message
or nothing on encountering such a page. Other browsers, such as those on
handheld devices etc. are likely to give unpredictable results. Search
engines may also fail to correctly parse or simply choose to ignore such
pages. It also creates a very bad impression to technically savvy viewers of
your pages.

There are of course much better ways to achieve the desired result in a
correct and potentially less problematic manner. Utilising Google with the
phrase 'center web page' is likely to return hundreds of references to
descriptions - probably none resembling that usually proposed here, but
many resembling that which follows:-
A simple (correct) method for Publisher 2007 pages:

Edit your .htm file(s) with any text editor.
Replace the phrase "<body style='margin:0'>" with "<body style='margin:0;
text-align:center;'><div style='text-align:left; width:760px;'>"

(substitute the value "760px" (760 pixels) with a higher or lower value to
suit your page width if required)

Further down the page. replace the phrase "</body>" with "</div></body>"

This method is obviously similar in complexity to do, but it can also be
achieved easily on multiple files by using ReplaceInFiles, although there
are better and more powerful programs available for that task. It can be
applied to any web page but the initial <body> tag will vary from that above
in pages from sources other than Pub 2007, so a small adjustment to suit
will probably be needed.
 
S

Spike

Eric

Followed your suggestion. I still have left justification as the result
using publisher 2007 Vista IE 8.
For now I will stick to what seems to work for me.
Thanks anyway

Spike
 
E

Eric James

What page are you trying it out on?


Spike said:
Eric

Followed your suggestion. I still have left justification as the result
using publisher 2007 Vista IE 8.
For now I will stick to what seems to work for me.
Thanks anyway

Spike
 
E

Eric James

err... I think I could probably have guessed that. I was intimating that you
might provide a url...
However, the technique does work and there are umpteen examples and
descriptions of how to do it available on the web. You will learn more by
doing your own research, but you could start here, for example:
http://www.wikihow.com/Center-Web-Page-Content-Using-CSS
That site presents a slightly different approach than I suggested in putting
the style statements in the header instead of in-line, but it doesn't make
much difference. You should find that there is already a <style> block in a
Publisher header, so the required statements can be put in there also, but
they should be at the bottom of it to override any earlier definitions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top