I want to make the 'tinynav' mobile screen's navigation to appear in the center of any device.
In this case I'm testing on iPhones 4s and 5. I can accomplish this in portrait mode but not in Landscape mode. I believe this is because both devices share the same with in portrait mode, but not in Landscape.
Media queries used:
/*iPhone 5 landscape*/
@media only screen and (min-device-width : 481px) and (max-device-width : 568px) and (-webkit-min-device-pixel-ratio:2) and (orientation : landscape) {
#mainNav .tinynav {
display: inline-block;
padding: 0 !important;
right: 0;
border: 1px solid #000;
margin-left: 35% !important;
margin-top: 7%;
}
/*iPhone until 4s landscape*/
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) and (orientation : landscape) {
#mainNav .tinynav {
display: inline-block;
padding: 0 !important;
right: 0;
border: 1px solid #000;
margin-left: 51% !important;
margin-top: 7%;
}
I tried also using the known media query por iPhone 5 Landscape:
@media only screen and (min-device-width : 320px) and (max-device-width : 568px) and (orientation : landscape) {}
But no luck, because the 'margin-left:% !important override between themselves and if I don't use !important, then the command is not rendered by the browser.
So I need a CSS that would make it to be centered automatically.
I've also tried:
{margin-left:auto;} {margin-right:auto}
But no results either.
Here's a fiddle