CSS按钮无法在iPad上正确呈现

时间:2016-06-23 02:38:59

标签: html ios css render

我在web应用程序上创建了一个用css创建的按钮,当我在android上测试Chrome上的按钮时,按钮渲染得很好并因为z-index属性而保持在所有内容之上:

Android Button

但是当我在IOS上测试Chrome上的相同内容时,它并没有按照预期的方式呈现按钮,并且不尊重z-index属性:

enter image description here

我试图添加" -webkit-appearance:none;"到css但它没有工作继承人css和html:



#PINPOINT {
  -webkit-appearance: none;
  width: 70px;
  height: 70px;
  margin: 15px auto;
  position: relative;
  z-index: 5000;
}

#BUTTON {
  -webkit-appearance: none;
  box-sizing: border-box;
  color: rgba(0, 0, 0, 0.870588);
  height: 70px;
  text-align: left;
  width: 70px;
  column-rule-color: rgba(0, 0, 0, 0.870588);
  perspective-origin: 227.828px 35px;
  transform-origin: 227.828px 35px;
  border: 0px none rgba(0, 0, 0, 0.870588);
  font: normal normal normal normal 14px / 21px Roboto, sans-serif;
  outline: rgba(0, 0, 0, 0.870588) none 0px;
  position: fixed;
  right: 0;
}

#TEXT {
  -webkit-appearance: none;
  bottom: 0px;
  box-shadow: rgba(0, 0, 0, 0.156863) 0px 2px 5px 0px, rgba(0, 0, 0, 0.117647) 0px 2px 10px 0px;
  box-sizing: border-box;
  color: rgb(255, 255, 255);
  cursor: pointer;
  display: inline-block;
  height: 55.5px;
  left: 0px;
  letter-spacing: 0.5px;
  position: relative;
  right: 0px;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  top: 0px;
  vertical-align: middle;
  width: 55.5px;
  will-change: opacity, transform;
  z-index: 1;
  column-rule-color: rgb(255, 255, 255);
  perspective-origin: 27.75px 27.75px;
  transform-origin: 27.75px 27.75px;
  background: rgb(239, 83, 80) none repeat scroll 0% 0% / auto padding-box border-box;
  border: 0px none rgb(255, 255, 255);
  border-radius: 50% 50% 50% 50%;
  font: normal normal normal normal 14px / 56px Roboto, sans-serif;
  margin: 0px 0px 14px;
  outline: rgb(255, 255, 255) none 0px;
  overflow: hidden;
  transition: all 0.3s ease-out 0s;
}

<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet"/>

<div id="PINPOINT">
  <div id="BUTTON">
    <a href="javascript:void(0);" id="TEXT"><i class="fa fa-reply" aria-hidden="true"></i></a>
  </div>
</div>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:1)

您可以使用flexbox使它们水平和垂直对齐。这是代码。

&#13;
&#13;
#PINPOINT {
	-webkit-appearance: none;
	width: 70px;
	height: 70px;
	margin: 15px auto;
	position: relative;
	z-index: 5000;
}

#BUTTON {
	-webkit-appearance: none;
	box-sizing: border-box;
	color: rgba(0, 0, 0, 0.870588);
	height: 70px;
	text-align: left;
	width: 70px;
	column-rule-color: rgba(0, 0, 0, 0.870588);
	perspective-origin: 227.828px 35px;
	transform-origin: 227.828px 35px;
	border: 0px none rgba(0, 0, 0, 0.870588);
	font: normal normal normal normal 14px / 21px Roboto, sans-serif;
	outline: rgba(0, 0, 0, 0.870588) none 0px;
	position: fixed;
	right: 0;
}

#TEXT {
	-webkit-appearance: none;
	box-shadow: rgba(0, 0, 0, 0.156863) 0px 2px 5px 0px, rgba(0, 0, 0, 0.117647) 0px 2px 10px 0px;
	box-sizing: border-box;
	color: rgb(255, 255, 255);
	cursor: pointer;
	height: 55.5px;
	letter-spacing: 0.5px;
	position: relative;
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
	vertical-align: middle;
	width: 55.5px;
	will-change: opacity, transform;
	z-index: 1;
	transform-origin: 27.75px 27.75px;
	background: rgb(239, 83, 80) none repeat scroll 0% 0% / auto padding-box border-box;
	border: 0px none rgb(255, 255, 255);
	border-radius: 50% 50% 50% 50%;
	font: normal normal normal normal 14px / 56px Roboto, sans-serif;
	margin: 0px 0px 14px;
	outline: rgb(255, 255, 255) none 0px;
	overflow: hidden;
	transition: all 0.3s ease-out 0s;

	/*Use flexbox property to fix this.*/
	display: flex;
	justify-content: center;
	align-items:center;
}
&#13;
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">
<div id="PINPOINT">
  <div id="BUTTON">
    <a href="javascript:void(0);" id="TEXT"><i class="fa fa-reply" aria-hidden="true"></i></a>
  </div>
</div>
&#13;
&#13;
&#13;