Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS ‘display: table’ makes div display smaller on Android device

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #38673
    mark_a_b
    Member

    Hi,

    I’m working on a project where I have a stationary bar (to become nav bar), and then directly below it is a rectangle which is setup so that when you click it, it flips over. The width of both the nav and the flipping div are supposed to be the exact same, and they are when viewed in FF, Chrome, Safari, IE…but when I just checked it in the Android browser, the flipping div is about 10 px less in width than the nav bar. I’ve narrowed this down to the fact that I’m using ‘display: table’ in the div ‘outerContainer’ to vertically and horizontally center the contents of ‘innerContainer’ (which is set to be display: table-cell). This is an example of how I currently have it setup, which displays correctly in all browsers but the width of the flipping box is less in Android browser: http://jsfiddle.net/adRP4/9/

    As soon as I remove the ‘display:table’ from .outerContainer, it displays in the Android browser at the proper width, however the content is no longer centered as I want it. This example shows the display: table removed will the proper width displaying, but the content not centered as I want it: http://jsfiddle.net/adRP4/10/

    The vertical/horizontal centering method I used is based on: http://www.andy-howard.com/verticalAndHorizontalAlignment/index.html (similar to https://css-tricks.com/vertically-center-multi-lined-text/) … when I tried changing it to the method outlined her: https://css-tricks.com/centering-in-the-unknown/ I ran into all kinds of problems…

    Any suggestions on how to fix this?

    Thanks,
    Mark

    #104969
    mark_a_b
    Member

    Update–When I checked this on an iPhone, I had the exact same problem that I did in Android, with the width’s not matching up….

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘CSS’ is closed to new topics and replies.