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

Thread: center the content issue in chrome browser with margin auto

Hybrid View

  1. #1
    Join Date
    Apr 2005
    Posts
    132

    center the content issue in chrome browser with margin auto

    I am trying to center the below div. It works fine in IE and firefox. But in chrome it centers but is giving the shaking effect on clicking on other buttons in the page. setting the margin 'auto' is giving this problem. How to solve this?

    Any help is appreciated. Thanks.
    Below is the sample html.

    <body>
    <div id="test">
    </div>
    </body>

    css:
    #test {
    margin-left: auto;
    margin-right: auto;
    width: 600px;
    }

  2. #2
    Join Date
    Aug 2012
    Posts
    155
    This is not to do with centering so it must be something to do with the positioning of your buttons. What is the html and css for those?

  3. #3
    Join Date
    Apr 2005
    Posts
    132
    figured out what the issue was.

    Centering was working fine.
    The shaking of the content was due to the vertical scroll bar removal.

    when I hit on a button, data gets refreshed. This was causing to remove vertical scroll bar and putting it back when the data came back from server. Since I set the div margin to auto it was trying to center when the scroll bar is removed and came back which was causing the shaking of content in the div.

    Fixed it by setting the min-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