html - 单击链接时主导航移动
问题描述
我试图截取屏幕截图以帮助更好地描述问题,但没有运气捕捉到。
我正在尝试解决我的网站http://abrielshipley.com上的问题,其中主导航的位置似乎正确。
当我单击其中一个主导航链接时,主导航会位于左侧徽标的下方。当单击主导航链接之一时,如何解决此问题主导航是否仍显示在屏幕右上角的正确位置?
以下是 SASS 中主要导航元素的一些代码:
nav
width: initial
border: none
display: inline-block
margin-right: 0
position: absolute
right: 4em
&:active
display: block
position: static
width: 100%
li
display: block
line-height: 3.5em
text-align: center
li:first-of-type
margin-right: 1.5em
a
border: none
font-size: 1.125em
display: list-item
header a
color: #FFF
cursor: pointer
text-decoration: none
text-transform: uppercase
-webkit-transition: all 0.5s ease-in-out
-moz-transition: all 0.5s ease-in-out
-o-transition: all 0.5s ease-in-out
transition: all 0.5s ease-in-out
&:hover
color: #D8D8D8
&:focus
outline: 1px solid #F1F1F1
解决方案
只需删除这个:
&:active
display: block
position: static
width: 100%
推荐阅读
- django - 带有 2 个提交按钮的 Django POST 表单,“输入”行为
- wordpress - Flaton 主题 - 主题选项不保存
- c# - AvaloniaUI - 如何直接在画布上绘制
- python - sklearn ValueError:输入包含 NaN
- flutter - 有没有办法在颤动中只改变图标颜色的一部分?
- c++ - 共享模式中的 WASAPI 错误 AUDCLNT_E_CPUUSAGE_EXCEEDED
- php - 如何匹配或替换正则表达式中一个语句的两次出现的模式?
- google-apps-script - 应用脚本 - function () { [本机代码] }
- javascript - 返回组件消息 5 秒,然后重定向
- python - Matplotlib:如何删除轴并在旋转轴中设置 facecolor?