...

View Full Version : Centering page in ALL browsers



PapaGeek
07-29-2012, 04:39 PM
Andrew S. Tanenbaum, Computer Networks, 2nd ed., Oct 25, 1999, p. 254

“The nice thing about standards is that you have so many to choose from.”

I’m trying to modify my table design layouts to use pure CSS positioning. I have most of it working, but one of the basic concepts does not seem to work on ALL browsers. That is the ability to create a division that automatically centers the entire page in the width of the browser page.

I don’t want to use an odd DOCTYPE to allow stupid quirks to take place, but might not allow other newer features. I want to use a standard doctype.

I’m using the following CSS coding:
body { margin:0;padding:0; background-color: #E4C6AA;
background-repeat: no-repeat;
background-attachment: fixed;
background-position: top center;
background-image: url(781bg.jpg); }


.framework {width: 781px;
margin: 0 auto 0 auto;
clear: both;
}

And I’m including the entire page inside DIV class=”framework”, /DIV tags

Not surprising, it works on FF, but not IE8!

I’ve tried to include an “align: center;” line in the .framework definition, but no luck.

The only code I can get to work on EVERY browser is:


<body>
<!--framework--><table class="framework" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
Key the entire page here, using CSS for positioning inside the table.
</td>
</tr>
</table><!--end framework-->
<!--#extract end -->
</body>
</html>


.framework {width: 781px;}

Is there a consistent way to get rid of this table? Something that will always work on all browsers, old and new!

SB65
07-29-2012, 07:21 PM
If this works in Firefox but not IE8, that suggests there might be an issue with the doctype statement, causing IE8 to render the document in quirks mode. You can check this via the developer tools - F12 - where the document mode will be displayed.

PapaGeek
07-29-2012, 09:04 PM
SB65,
Thanks for that post, in a way it did clear up the problem, it pointed out the real problem.

It wasn’t the doctype, I had the right one. There is an issue with previewing file on your PC that include JavaScript in the onLoad position. When you try to display a page with JavaScript to browser pops up:

“To help protext your security, Internet Explorer has restricted this webpage from running scripts or ActiveX controls that could access your computer. Click here for options…”

To get around this issue and test the scripts I write, I precede my pages with the following line
<!-- saved from url=(0014)about:internet -->
It allows the browser to run the scripts without the pop-ups, but evidently forces the browser into quirk mode.

Does anyone know of another way to run scripted files without the popup?

felgall
07-29-2012, 10:21 PM
Move the JavaScript to the bottom of the page where you can then get rid of the onload completely.

Put the saved from AFTER the doctype.

PapaGeek
07-29-2012, 11:52 PM
Thanks felgall,

After the doctype works fine. I'll have to change my C++ code for the MySSI program to place it there when building files in the client directory for editing.

MySSI does add the saved line to the published files.

Major Payne
07-30-2012, 04:06 PM
... There is an issue with previewing file on your PC that include JavaScript in the onLoad position. When you try to display a page with JavaScript to browser pops up:

“To help protext your security, Internet Explorer has restricted this webpage from running scripts or ActiveX controls that could access your computer. Click here for options…”
...

Does anyone know of another way to run scripted files without the popup?Maybe this?

Disabling Cross Site Scripting (XSS) filtering in Internet Explorer 8 (PDF): https://jobs.missouri.edu/howtos/DisableIE8XSS.pdf
How to Disable Error Reporting in Internet Explorer: http://www.ehow.com/how_4894202_disable-error-reporting-internet-explorer.html



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum