gpt4 book ai didi

html - 如何停止事件菜单项在选择时拖动整个数组

转载 作者:行者123 更新时间:2023-11-28 18:22:06 26 4
gpt4 key购买 nike

我有一个专为移动屏幕设计的菜单栏。

我正在尝试对其进行格式化,以便当您“单击”图像时它会下降 3 个像素以指示其选择 - 但是我使用的代码会下降整个图像条。

代码如下:

#menubar {
position: absolute;
top: 15px;
left: 10px;
height: 30px;
padding: 5px;
margin: 0;
}
.touch_nav {
display: inline;
margin: 0;
min-width: 80px;
min-height: 80px;
color: #fff;
}
.touch_nav:active {
margin-top: 5px;
}
#navhome {
background: url('./img/mobile/homebutton.png')
}
#navabout {
background: url('./img/mobile/aboutbutton.png')
}
#navservices {
background: url('./img/mobile/servicesbutton.png')
}
#navdownload {
background: url('./img/mobile/downloadbutton.png')
}
#navenquiry {
background: url('./img/mobile/enquirybutton.png')
}

谁能告诉我我做错了什么?

最佳答案

.touch_nav:active { 
position:relative;
top: 5px;
}

这将相对于其当前位置定位元素,而不影响任何其他元素。

关于html - 如何停止事件菜单项在选择时拖动整个数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16597573/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com