Re: NEW centering thread
- From: "Eric James" <none@xxxxxxxxx>
- Date: Thu, 19 Nov 2009 21:09:05 -0000
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.
"Spike" <zero_spam@xxxxxxxxxx> wrote in message news:%23RKwCeIaKHA.5544@xxxxxxxxxxxxxxxxxxxxxxx
==================================
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
.
- Follow-Ups:
- Re: NEW centering thread
- From: Spike
- Re: NEW centering thread
- References:
- NEW centering thread
- From: Spike
- NEW centering thread
- Prev by Date: Microsoft Publisher 2003 and Internet Explorer8
- Next by Date: Re: Microsoft Publisher 2003 and Internet Explorer8
- Previous by thread: NEW centering thread
- Next by thread: Re: NEW centering thread
- Index(es):
Relevant Pages
|