dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: Website always in center

  1. #1
    Join Date
    Aug 2013
    Location
    Missouri
    Posts
    6

    Lightbulb Website always in center

    I am assuming this can only be done with JavaScript. I want my website to always be in the center no matter what browser you are using and no matter the size of your monitor. I understand that mobility is different and I am going to use a browser detect to redirect to a mobile version for my website. Right now I just want a way for my site to always be in center I am sure there is more than one method but what I look for online is not what I am looking for. I have HTML5 boilerplate installed on my website. Does anyway know of a solution or multiple solutions?

  2. #2
    Join Date
    Jul 2013
    Posts
    66
    Centered how? Horizontally or vertically? Either way you're looking for CSS, not Javascript.

  3. #3
    Join Date
    Aug 2013
    Location
    Missouri
    Posts
    6
    Both however there is going to be no scrolling so its basically just a rectangle in the middle of the screen positioned at the top. It is wide but not long. How do you even figure the center since it changes based on your monitor size and all last I know CSS does not have the capability to read screen size and adjust accordingly or am I misunderstanding the whole thing? Hope this helps and thank you for your help! :-)

  4. #4
    Join Date
    Jul 2013
    Posts
    66
    You don't need to know the size of the screen, that's what relative units (%) are for. Centering horizontally is a piece of cake, simply set your wrapper to "margin: 0 auto;". If you search for "CSS center vertically", you will get a variety of solutions to center your container vertically. You need to pick one based on your requirements (for example it would help a lot to have a fixed height).

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles