Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    10
    Member #
    33622

    css horizontal center: portion of left-hand side being cut off when browser minimized

    So I'm using this CSS to horizontally-center my main container div:

    #screenDoor{
    /*background-color: #FF0000;*/
    position: absolute;
    top: 0px;
    left: 50%;
    width: 1000px;
    min-height: 300px;
    height: auto;
    margin-left: -500px;
    padding: 0px;
    }

    and for mobile browsers I included the following meta viewport:

    <meta name="viewport" content="width=1000px, initial-scale=1">

    So everything works golden on mobile browsers. The issue is when I reduce the size of my browser window on a regular computer it ends up cutting off about 25-50px on the left-hand side of my main container div. Has anyone encountered this? I tried making the overflow-x: visible but this does not correct the issue.

    Suggestions greatly appreciated.

  2.  

  3. #2
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    The problem is that you're trying to shoehorn a defined-width layout onto mobile, so the layout is breaking when a non-mobile browser is less than 1000px.
    It's working fine on mobile because you're forcing it to. Desktop browsers won't activate the viewport meta tag, so your layout will act the way it's supposed to, which is to stay at 1000px wide.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  4. #3
    Junior Member
    Join Date
    Nov 2012
    Posts
    10
    Member #
    33622
    Quote Originally Posted by Ronald Roe View Post
    The problem is that you're trying to shoehorn a defined-width layout onto mobile, so the layout is breaking when a non-mobile browser is less than 1000px.
    It's working fine on mobile because you're forcing it to. Desktop browsers won't activate the viewport meta tag, so your layout will act the way it's supposed to, which is to stay at 1000px wide.
    Okay, so I removed the viewport tag but I'm still experiencing the issue both on mobile platforms and desktop. I've tried expanding the width of the master container but it still ends up cutting-off the left-hand side. It seems it cuts off the left-hand side right up until a few pixels before it hits text. Any suggestions on how to fix this?


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 07:09 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com