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

Thread: Website Not Centered In Smart Phone ..... HELP

Hybrid View

  1. #1
    Join Date
    Apr 2009
    Posts
    346

    Website Not Centered In Smart Phone ..... HELP

    I have a website with a fairly basic layout that is aligning left in smart phones - or at least in the iPhone. If anyone has any idea how to remedy this then I'd HUGELY appreciate it!

    These are the styles:
    HTML Code:
    body {
           background-color: #e7e7e7;
    }
    #header {
            height: 150px;
    	width: 100%;
    	margin-right: auto;
    	margin-left: auto;
    	background-color: #FFFFFF;
    
    }
    #header_inner {
            height: 150px;
    	width: 980px;
    	margin-right: auto;
    	margin-left: auto;
    	position: relative;
    }
    #content {
            width: 980px;
            margin-right: auto;
            margin-left: auto;
            
    }
    #footer {
            background-color: #00703c;
    	width: 100%;
    	padding-bottom: 10px;
    	margin-right: auto;
    	margin-left: auto;
    	padding-top: 10px;
    }
    #footer_inner {
            width: 980px;
    	margin-right: auto;
    	margin-left: auto;
    	margin-top: 10px;
    	color: #FFFFFF;
    }
    This is the HTML layout:

    HTML Code:
    <body>
          <div id="header">
                <div id="header_inner"></div>
          </div>
          <div id="content"></div>
          <div id="footer">
                <div id="footer_inner"></div>
          </div>
    </body>
    Displayed on the computer, the content section is perfectly centered with the gray body background on either side. In a smart phone (iPhone) the content butts up against the left side of the screen, and everything is cut short on the left.

    Any ideas why?

  2. #2
    Join Date
    Aug 2012
    Posts
    4
    Have you managed to test it on any other phones? Do you have a site uploaded that we can look at? Just a guess, but it might be worth adding in a viewport to cope with smartphones connecting. Something like
    <meta name="viewport" content="width=device-width" />
    in your header might help.

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