Results 1 to 7 of 7

Thread: Vertical centering homepage

  1. #1
    Junior Member
    Join Date
    May 2016
    Posts
    3

    Question Vertical centering homepage

    My homepage vertically centers under NOF 7.5 in most browsers.

    It will not under NOF 15 even though I manually re-enter the code in "Page HTML":

    BEGINNING OF BODY

    <div ID="test">
    <table height="100%" width="100%">
    <tr><td valign="middle" align="center">

    END OF BODY

    </td></tr></table></div>

    Why does it work on 7.5 but not in 15?

  2. #2
    Senior Member chuckj's Avatar
    Join Date
    Jan 2010
    Location
    www.beyondfusion.com - Florida
    Posts
    1,302

    Default

    Don't enter code. Just check the box in layout properties that says Center in Browser.

    As long as you aren't using fixed layout and haven't manually entered any code that will prevent centering.
    Chuck Joslin
    www.BeyondFusion.com
    PHP & MySQL development with Fusion
    Fusion support for AllWebMenus (Likno) Contact me for custom AWM menus for your sites.
    Tutorials and Forums

  3. #3
    Junior Member
    Join Date
    May 2016
    Posts
    3

    Default

    Quote Originally Posted by chuckj View Post
    Don't enter code. Just check the box in layout properties that says Center in Browser.

    As long as you aren't using fixed layout and haven't manually entered any code that will prevent centering.
    Thanks, but checking the box has no effect. Went back to NOF 7.5. Centers fine with the above HTML.

  4. #4
    Senior Member franko's Avatar
    Join Date
    Apr 2010
    Location
    Tasmania Australia
    Posts
    2,639

    Default

    Then you have other code that's overriding the NoF generated code, not unusual if you've been manually entering code outside of NoF. First question, how did you transfer the site from 7.5 to 2015? Did you use the correct template method? If not, that could be the cause of your conflicting code. It's been a lot of years since i used 7.5 but I'm pretty sure the method of moving a site was still the same. 1. Reoptimisy the site. 2. Delete any unused assets. 3. Export the site as a template. Then in 2015 New Site from Template. Then see if you still have the problem or if the site now behaves as expected.

  5. #5
    Senior Member
    Join Date
    Apr 2010
    Location
    Sydney
    Posts
    1,947

    Default

    he is asking for vertical center, Nof does not have that option built in

  6. #6
    Senior Member franko's Avatar
    Join Date
    Apr 2010
    Location
    Tasmania Australia
    Posts
    2,639

    Default

    OOPS! Sorry about that. Amazing how preconceptions can colour one's reading. Never occurred to me somebody would want to centre a web page vertically. A popup window, yes, but a web site I've never seen before.

    You have to use absolute positioning and changing the doctype can stop it working, which is probably the reason it worked in 7.5 but not in 2015. 2015 uses the html 5 doctype. I don't know what doctype you used with the site. Here's a method that should work with all doctype and browsers using CSS:

    #mydiv {
    position:absolute;
    top: 50%;
    left: 50%;
    width:30em;
    height:18em;
    margin-top: -9em; /*set to a negative number 1/2 of your height*/
    margin-left: -15em; /*set to a negative number 1/2 of your width*/
    border: 1px solid #ccc;
    background-color: #f3f3f3;
    }

    Change the height and width and colours to suite yourself.
    Last edited by franko; 06-01-2016 at 11:26 PM.

  7. #7
    Junior Member
    Join Date
    May 2016
    Posts
    3

    Default

    Thanks very much for the tip. I'll give it a whirl tomorrow.

    My site's homepage is the only one I like to center; it looks better that way on larger screens. Here it is: http://www.policeissues.com.

    I'm not much of an html whiz but youse guys are giving me quite the education...

    Quote Originally Posted by franko View Post
    OOPS! Sorry about that. Amazing how preconceptions can colour one's reading. Never occurred to me somebody would want to centre a web page vertically. A popup window, yes, but a web site I've never seen before.

    You have to use absolute positioning and changing the doctype can stop it working, which is probably the reason it worked in 7.5 but not in 2015. 2015 uses the html 5 doctype. I don't know what doctype you used with the site. Here's a method that should work with all doctype and browsers using CSS:

    #mydiv {
    position:absolute;
    top: 50%;
    left: 50%;
    width:30em;
    height:18em;
    margin-top: -9em; /*set to a negative number 1/2 of your height*/
    margin-left: -15em; /*set to a negative number 1/2 of your width*/
    border: 1px solid #ccc;
    background-color: #f3f3f3;
    }

    Change the height and width and colours to suite yourself.

Posting Permissions

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