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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    9
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Question Vertical centering/centering in HTML..

    Massive thanks to "Arbitrator" from Texas for some help with image resizing - now for my (hopefully!) final question...
    I've written my first site in HTML5/CSS and other than a bit of tidying up its finished...with the exception of it being 'centred' on a vertical as well as horizontal basis. I'd like to see it sitting in the middle of the screen when its viewed on anything bigger than 17" monitor.
    Can anybody advise me on this? The site URL is: www.chrisandersonarchitects.co.uk

    Many thanks,

    Jim

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello jim5358,
    Most vertical centering works by knowing the height of the element you're centering. See these examples.

    For a fluid height element like your .container to be centered, have a look at this jQuery solution.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #3
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    9
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Many thanks for your reply - I've read through the links, I'm just a little unsure how/where to paste in the text...? :/

    Quote Originally Posted by Excavator View Post
    Hello jim5358,
    Most vertical centering works by knowing the height of the element you're centering. See these examples.

    For a fluid height element like your .container to be centered, have a look at this jQuery solution.

  • #4
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,316
    Thanks
    29
    Thanked 279 Times in 273 Posts
    Quote Originally Posted by jim5358 View Post
    I've written my first site in HTML5/CSS and other than a bit of tidying up its finished...with the exception of it being 'centred' on a vertical as well as horizontal basis. I'd like to see it sitting in the middle of the screen when its viewed on anything bigger than 17" monitor.
    I think you're going to find this task to be a lot more difficult than you bargained for. This is why I did not address your comment on the subject in your previous thread; it's too much work to conditionally vertically align content to the browser viewport for only a minor aesthetic improvement.
    For every complex problem, there is an answer that is clear, simple, and wrong.


  •  

    Posting Permissions

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