html - 删除手机上的链接

标签 html css

我有一个 div,我想在屏幕为移动设备大小时隐藏它。目前我有

html

<div id='top-btn'>
    <a class="fade-in" href="...">Top</a>
</div>

CSS

#top-btn a {
  visibility: visible;
  opacity: 1;
  position: fixed;
  ...
}

@media screen and (max-width: 768px) {

#top-btn a { display: none; }

}

div 已隐藏,但按钮仍然存在,因此仍有一个区域可以链接(可点击)。我希望它完全消失,这样他们就无法点击它

最佳答案

您需要删除整个按钮,而不仅仅是链接本身:

@media screen and (max-width: 768px) {
    #top-btn { display: none; }
}

希望这对您有所帮助!

关于html - 删除手机上的链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41581364/

相关文章:

javascript - 如何在打印时添加出现在每一页上的图像横幅?

javascript - 调整表格大小超出屏幕范围

html - 显示 : table-cell, 内容和填充

javascript - 如何检查跨度内的数字并根据值更改其颜色?

html - 响应式网页有问题

javascript - 如何让html打印javascript函数的返回值?

javascript - 元视口(viewport)和 Android 的问题

Javascript 动画 CSS float 属性

css - SASS 检查类名

html - 照片网格似乎不合适