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?
Sorry, I should have said this. I did use an external style sheet (just mentioned div style to convey the point). What about the center tag? Is it okay to use it or have I been correctly informed that it will be weeded out?
> And you might have to fix your layout with media queries for mobile devices.
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).
> For mobile devices, > I tend to set divs to width 90% / 95% and then margin: 0 auto; them
What difference does that give over specifying the width in px and then setting the margin to 0 auto? Because I know that my method doesn’t work. I’ll try the meta viewport today. If not, I’ll have to check media queries.
Viewing 11 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic.
*May or may not contain any actual "CSS" or "Tricks".