html - 奇怪的事件处理
问题描述
我制作了一个简单的网站,其中包含左右固定位置的箭头 (png) 图像,链接到下一页。
问题是光标无法选择包含图像的锚元素,如下所示:
.
这是元素的代码:
<a class="arrow-left" href="previousPage.php"><img src="img/left.png"></a>
<a class="arrow-right" href="nextPage.php"><img src="img/right.png"></a>
如您所见,它是纯 html 代码,.arrow-left
and.arrow-right
类使用 scss 进行样式设置:
.arrow-right {
position: fixed;
max-width: 3%;
z-index: 10;
right: 1%;
top: 50%; }
.arrow-left {
position: fixed;
max-width: 3%;
z-index: 10;
left: 1%;
top: 50%; }
解决方案
你可以试试and display: block
。.arrow-right
.arrow-left
提示:
如果您以更紧凑的方式编写代码,将来会更容易修改:
.arrow-right,
.arrow-left {
display: block;
position: fixed;
max-width: 3%;
z-index: 10;
top: 50%;
}
.arrow-right {
right: 1%;
}
.arrow-left {
left: 1%;
}
然后你只需要在一个地方编辑代码来添加display: block;
推荐阅读
- node.js - 在猫鼬中多次添加相同产品时如何更新购物车
- javascript - 替换数组的多个元素同时保持它们的位置
- oracle - 在 Oracle DB 中运行存储过程并使用批处理脚本运行它
- python - 打开文件中的python错误(编解码器无法解码位置2-3的字节),我使用spyder
- perl - 导出的 perl 模块子例程不可用
- html - 轮播不工作也不响应
- angular - Angular 6 - textarea(更改)永远不会更改 textarea 的内容
- c# - 带有 ASP.NET Core 控制器/ServiceProviderScope 的 AsyncLocal
- python - 从 Bitmex API json 转换问题读取价格图表
- c - 将一个值增加到特定值,然后再减小到初始起点?