Forums

Give help. Get help.

  • # January 6, 2013 at 9:10 am

    Hello,

    I’m in a bit of a fix. I’m working on a project and the method **div style=”margin:0 auto;”** works perfectly fine of a desktop, but gets messed up on mobile devices.(information getting randomly aligned as opposed to horizontal center). Strangely enough, on an earlier website , I used the “center” tag and _that_ seems to work like a charm. It even aligns itself beautifully in the landscape and portrait modes perfectly on mobile devices.

    I’m reluctant to use the ‘center’ tag as I’m told this tag will be eventually weeded out. Any suggestions?

    # January 6, 2013 at 9:12 am

    Use a stylesheet, not inline css. And you might have to fix your layout with media queries for mobile devices.

    # January 6, 2013 at 9:27 am

    just to confirm what you’ve heard, the center tag IS deprecated in html5.

    # January 6, 2013 at 9:29 am

    You set the width to 990px which won’t work on mobile as it’s much wider than a typical mobile viewport. You could try `max-width` but I would use media queries.

    # January 7, 2013 at 2:52 am

    I Did have a problem design for mobile once, where are give a white space on the right side of the device, to solve the problem I’ve used the meta declaration for view port from [H5BP](http://html5boilerplate.com/).

    Inside my Head tag.
    Try it out, if don’t work let us know, and if possible host the code somewhere (on your host or codepen, gist, you know).

    # January 7, 2013 at 2:56 pm

    For mobile devices, I tend to set divs to width 90% / 95% and then margin: 0 auto; them. But yea, don’t forget the meta viewport which will sort everything out for you :)

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag