Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

iPhone browsers (chrome and safari) output different compared to other browsers 1

Status
Not open for further replies.

jason.lex

Vendor
Jan 3, 2019
10
HK
I have made a mobile version of the page and need to center a button over an image.

I used the example given here,
but for some reason the actual iPhone browsers (Chrome and Safari) both showing that the button isn't actually centered like it is in the desktop or ChromeTools.
Even Android browser shows the buttons is centered. Just not browsers in iPhone....

Is there a way to fix it so that both Android and iPhone shows the same result?


 
Try adding
Code:
-webkit-transform: translate(-50%, -50%);
to your CSS from the Example
Code:
/* Style the button and place it in the middle of the container/image */
.container .btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
*******add it here**********
  background-color: #555;
  color: white;
  font-size: 16px;
  padding: 12px 24px;
  border: none;
  cursor: pointer;
  border-radius: 5px;
}
Not 100% sure if it helps though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top