• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "@&*%$£!!!! browsers! Centring problem"

Collapse

  • NickFitz
    replied
    Originally posted by xoggoth View Post
    Needless to say the jscript interactives don't work either although they begin ok so Safari obviously supports canvas but there is no error shown or handy debug window like Firefox. Those I think I'll skip. It would be great if all browsers worked the same. IE gets blamed for not following standards but even the others are not fully consistent.

    Ta again for all the suggestions.

    PS Thought I ought to get Opera too so can can check site works in all main browsers. I note the licence agreement says "NOT FOR USE IN ONLINE CONTROL OF AIRCRAFT". Maybe I should add this to agreement on my nature software just in case.
    Safari was the browser that introduced the <canvas> element, so their implementation should probably be seen as the correct one. There's a detailed description of how it should work in the HTML 5 spec, but that's still very much a work in progress - although I think <canvas> is pretty stable by now.

    I've never used Safari on Windows, but on the Mac version the "Advanced" pane of the preferences has a checkbox for "Show Develop menu" - this then allows you to get to the JavaScript console to see any errors.

    Leave a comment:


  • krytonsheep
    replied
    If you want to do layouts with cross-browser support I'd recommend using the Yahoo YUI library. Takes 99% of the pain out of it.

    Leave a comment:


  • xoggoth
    replied
    Needless to say the jscript interactives don't work either although they begin ok so Safari obviously supports canvas but there is no error shown or handy debug window like Firefox. Those I think I'll skip. It would be great if all browsers worked the same. IE gets blamed for not following standards but even the others are not fully consistent.

    Ta again for all the suggestions.

    PS Thought I ought to get Opera too so can can check site works in all main browsers. I note the licence agreement says "NOT FOR USE IN ONLINE CONTROL OF AIRCRAFT". Maybe I should add this to agreement on my nature software just in case.
    Last edited by xoggoth; 31 January 2009, 11:22.

    Leave a comment:


  • Durbs
    replied
    Originally posted by NickFitz View Post
    HTH

    Thinking about it, wouldn't the "align" attribute on the table work?

    Code:
    <table width="800" align="center">
    You'd have thought so but in practice not always so in certain browsers. Your first solution was spot on. I always just use:

    #MainContentTbl
    {
    width:790px;
    border-collapse:collapse;
    padding:0px;
    vertical-align:top;
    padding:5px;
    text-align:left;
    margin-left: auto;
    margin-right: auto;
    }

    The border-collapse gets rid of the horrible detached borders.

    Leave a comment:


  • NickFitz
    replied
    Originally posted by xoggoth View Post
    Cheers nick (yet again!) , that works and was easy just to stick in css file! Ta also, suityou01, that would also work but take longer. I'm a lazy b*.
    HTH

    Thinking about it, wouldn't the "align" attribute on the table work?

    Code:
    <table width="800" align="center">
    (Although it's so long since I used attributes to lay out a page, I can't quite remember.)

    Ah, yes, here in the HTML spec:
    align = left|center|right [CI]
    Deprecated. This attribute specifies the position of the table with respect to the document. Permitted values:
    • left: The table is to the left of the document.
    • center: The table is to the center of the document.
    • right: The table is to the right of the document.

    Leave a comment:


  • xoggoth
    replied
    Cheers nick (yet again!) , that works and was easy just to stick in css file! Ta also, suityou01, that would also work but take longer. I'm a lazy b*.

    Leave a comment:


  • NickFitz
    replied
    Originally posted by xoggoth View Post
    It beats me why browsers can't be consistent in this most basic simple thing!
    Got my small business website to work in both IE and Firefox using center and moz-center (how stupid is that?) with main body of text in middle and my sister's arty farty pictures down the edges. Now I find it does not work in even stupider Safari!!

    If I have a table 800px wide how do I make sure it appears in the centre of the browser in ALL common browsers??

    Cheers for any ideas.
    text-align: center shouldn't actually centre a table: that's an IE bug. (It also probably won't work in IE 8 in standards mode.) I'm not sure what the motivation for -moz-center was, but it's still wrong.

    To centre it set its left and right margins to auto:

    Code:
    table {
        margin-left: auto;
        margin-right: auto;
    }
    If you're not appying any top or bottom margin to the table you can use the shorthand version:

    Code:
    table {
        margin: 0 auto;
    }
    If you do want top and bottom margins with different values you can use

    Code:
    table {
        margin: 1em auto 2em; /*1em top, 2em bottom */
    }
    NOTE: as I'm sure you're aware, that will apply it to every table; to apply it to a specific table or a general class of tables, use the appropriate selector:

    Code:
    #table_with_id {
        margin: 1em auto 2em; /*1em top, 2em bottom */
    }
    
    .table_with_class {
        margin: 1em auto 2em; /*1em top, 2em bottom */
    }
    Last edited by NickFitz; 30 January 2009, 21:49.

    Leave a comment:


  • suityou01
    replied
    Originally posted by xoggoth View Post
    It beats me why browsers can't be consistent in this most basic simple thing!
    Got my small business website to work in both IE and Firefox using center and moz-center (how stupid is that?) with main body of text in middle and my sister's arty farty pictures down the edges. Now I find it does not work in even stupider Safari!!

    If I have a table 800px wide how do I make sure it appears in the centre of the browser in ALL common browsers??

    Cheers for any ideas.

    Table layouts are usually frowned on, but I've used them when "necessary". And I don't want to get into a debate with webbos about tables vs divs. I am not a webbo, just have to do some front end stuff sometimes, when the backend work dries up.

    Try and create a table

    <table width=100%>

    and create a row with one cell

    <tr>
    <td align="center"><your 800px table goes here</td>
    </tr>
    </table>

    Cheap n cheerful and cross browser.

    Love to hear of better ways though.

    Leave a comment:


  • voodooflux
    replied
    Are you after just horizontal centering, or vertical as well?

    Leave a comment:


  • xoggoth
    started a topic @&*%$£!!!! browsers! Centring problem

    @&*%$£!!!! browsers! Centring problem

    It beats me why browsers can't be consistent in this most basic simple thing!
    Got my small business website to work in both IE and Firefox using center and moz-center (how stupid is that?) with main body of text in middle and my sister's arty farty pictures down the edges. Now I find it does not work in Safari!!

    If I have a table 800px wide how do I make sure it appears in the centre of the browser in ALL common browsers??

    Cheers for any ideas.
    Last edited by xoggoth; 31 January 2009, 11:15.

Working...
X