我有一个很长的垂直视差网站。
该网站的移动版本略有不同,但使用相同的 anchor 共享相同的导航。
我正在尝试将 id 添加到 anchor 标记 - 这样我就可以在移动分辨率下使用 css 移动它们。
<a id="anchor1" href="#anchor1"></a>
但它没有被阅读——有什么建议吗?
@media(max-width:700px) and (min-width:100px) {
a#anchor1 { margin-top:-110px; position:absolute;}
最佳答案
你错过了屏幕部分,我会找到另一种方法来获取元素而不是 id,要么是 a[href="#"] 要么把类放在 anchor 上,否则你将不得不把代码写成时间取决于您有多少个链接。
@media screen and (max-width:700px) and (min-width:100px) {
a#anchor1 { margin-top:-110px; position:absolute;}
}
关于jquery - 移动 anchor 带有 ids 和 css 的标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27912184/