英文:
Can we make a nav color dynamic with some button to click and add js on it?
问题
嗨,我是编程世界的新手,我做了一个小导航栏,像这样,我想添加一个按钮,当点击它时,它应该改变颜色。
在此输入图像描述
我已经制作了导航栏并添加了所有图标,但现在我不知道如何为它添加功能。
英文:
Hi I am new at the world of programming I make a small nav bar like this and I want to add a button when it click it should change the color.
enter image description here
I made the nav bar and brought all icons but now I don't know hot to add a functionality on it.
答案1
得分: 1
以下是翻译好的部分:
有一些使用伪类和选择器来改变颜色的方法。
<selector>:hover {
/*
当鼠标移动到链接上时,你可以在这里做一些变化。
*/
}
<selector>:focus {
/*
这意味着当鼠标按住鼠标左键并保持按下时,可以在这里进行一些变化。
*/
}
<selector>:visited {
/*
这可能是你希望在用户访问链接后执行的效果。
*/
}
还有更多的伪类可以使用,请查看以下链接。
https://developer.mozilla.org/en-US/docs/Web/CSS/:visited
英文:
There are few way to change color with pseudo-classes with selectors.
<selector>:hover {
/*
when the mouse move over to the link then you can do something change in here.
*/
}
<selector>:focus {
/*
which means that when the mouse hold the mouse left click keep press do something change in here.
*/
}
<selector>:visited {
/*
this might you want effect when user visited the link css to do.
*/
}
There has more pseudo-classes can do, please check the link.
https://developer.mozilla.org/en-US/docs/Web/CSS/:visited
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论