html - How can I center my login/inquire buttons when on mobile displays? -
i working on responsive website
that changes header when goes below 450 pixels. going except need inquire , log in buttons center when below 450 pixels.
screenshot of buttons reference
i tried
margin-left:auto; margin-right:auto; and
text-align:center; this didn't work. instead, gave both icons a
margin-left: 40px; this worked, on android phones. on iphones, broke 2 lines.
i don't have screenshot of can see effect
here
css
#headericons img{ float:right; margin-top:30px; margin-right:10px; } /*float icons right on medium sized screens*/ @media , (min-width: 628px) , (max-width: 989px){ #headericons img{ display:block; float:right; margin-left:15px; margin-top:10px; } } /*float left again tablets*/ @media , (min-width: 451px) , (max-width: 627px){ #headericons img{ display:block; float:left; margin-left:3px; margin-top:10px; } } /*center phones*/ @media , (min-width: 0px) , (max-width: 450px){ #headericons img{ display:block; float:left; margin-top:10px; margin-left:40px; } } and here html
<div class="d10-d12 m-1" id="headericons"> <img id="loginicon" src="images/new_logoin_vi.jpg" width="116" height="37"> <img id="inquireicon" src="images/new_inquire_button_vi.jpg" width="116" height="37" > </div>
try using display: inline-block & removing float; should able use text-align: center; or margin: auto; on containing div.
Comments
Post a Comment