我首先提供示例和截图:
HTML:
<div class="add-link-box">
<div class="add-link-box-close-button" id="add-link-box-close-button">X</div>
<form name="add-link" id="add-link-form" method="post" action="" enctype="multipart/form-data">
<div style="width: 90%;" class="alink-field">Add A Link</div>
<div class="mobile-form-frame" id="mobile-form-frame">
<div class="alink-field mobile-alink"><label for="link-url">Link Address:</label></div>
<div class="alink-field"><input type="text" name="linkurl" id="link-url" class="add-link-form"
placeholder="www.awebsite.com"></div>
<div class="alink-field mobile-alink"><label for="link-description">Link Description:</label></div>
<div class="alink-field"><input type="text" name="linkdescription" id="link-description" class="add-link-form" placeholder="my
website"></div>
<div class="alink-field mobile-alink"><label for="link-image">Link Image:</label></div>
<div class="alink-field"><input type="file" name="linkimage" id="link-image" class="add-link-form"></div>
<div class="alink-field"><input type="button" name="submit" value="Submit Link" class="add-link-form" id="add-link-submit"></div>
<div class="alink-field"><input type="reset" name="reset" value="Clear" class="add-link-form" id="reset"></div>
</div>
</form>
</div>
CSS:
.add-link-box{border: 2px #006BB5 solid; color: #006BB5; font-family: bonvenocf; text-align: center; font-size: 16pt; margin: 10px; height: 90%; margin-top: 30px; overflow: auto; -webkit-overflow-scrolling: touch;}
.mobile-form-frame{overflow: auto; height: 90%;}
.add-link-box-close-button{position: absolute; display: block; right: 5px; top: 5px; width: 20px; height: 20px; padding: 2px; line-height: 18px; font-size: 18pt; text-align: center; cursor: pointer; font-weight: bold; color: #FF0000;}
.add-link-box-close-button:hover{color: #FF0000;}
.alink-field{width: 90%; margin: 0px; display: block; padding: 10px; margin-left: auto; margin-right: auto; text-align: center;}
.mobile-alink{text-align: left;}
问题在于:
将-webkit-overflow-scrolling: touch;
添加到mobile-form-frame
类时(为了在iOS设备上实现原生滚动),&#34; X&#34;关闭这个div是隐藏的。如果我们删除-webkit-overflow-scrolling: touch;
,则不会。我已经做了一些搜索,但是找不到其他人也遇到过同样的问题。我不明白为什么这会导致绝对定位的div add-link-box-close-button
被遮挡。有谁能帮我解决这个问题?它实际上是iOS上Safari的一个错误吗?
我已经附上了截图来展示我遇到的结果。
编辑:上面的html包含在position: fixed;
答案 0 :(得分:0)
不只是专家而已,如果您移动“ X” z索引会怎样?你尝试过吗?
也许显示了X,但没有显示在前景上。只是一个想法
答案 1 :(得分:0)
使用此CSS
.add-link-box {
position: relative;
}