Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Jul 2011
    Posts
    40
    Thanks
    4
    Thanked 1 Time in 1 Post

    Centering page in ALL browsers

    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:

    Code:
    <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!

  • #2
    Senior Coder
    Join Date
    Feb 2009
    Location
    Ilkley, West Yorkshire, UK
    Posts
    2,956
    Thanks
    9
    Thanked 727 Times in 721 Posts
    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.

  • Users who have thanked SB65 for this post:

    PapaGeek (07-29-2012)

  • #3
    New Coder
    Join Date
    Jul 2011
    Posts
    40
    Thanks
    4
    Thanked 1 Time in 1 Post
    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?

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    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.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • Users who have thanked felgall for this post:

    PapaGeek (07-29-2012)

  • #5
    New Coder
    Join Date
    Jul 2011
    Posts
    40
    Thanks
    4
    Thanked 1 Time in 1 Post
    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.

  • #6
    Regular Coder
    Join Date
    Aug 2005
    Location
    MS
    Posts
    844
    Thanks
    11
    Thanked 79 Times in 77 Posts
    Quote Originally Posted by PapaGeek View Post
    ... 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_disa...-explorer.html
    ☠ ☠RON☠ ☠


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •