
elementUI 菜单栏下划线如何去除
在使用 elementUI 菜单栏时,默认情况下,选中菜单项后会出现一条下划线。然而,有时我们可能需要去除这条下划线,以获得更简洁美观的效果。
解决这个问题的方法非常简单,只需要在菜单项的 <li> 元素上添加 text-decoration: none; 样式即可。具体步骤如下:
首先,在 <style> 标签中添加以下 CSS 样式:
.el-menu--horizontal > .el-menu-item:hover,
.el-menu--horizontal > .el-menu-item:focus,
.el-menu--horizontal > .el-menu-item.is-active,
.el-menu--horizontal > .el-menu-item.is-opened {
text-decoration: none;
}然后,在 HTML 代码中,为选中菜单项的 <li> 元素添加 is-active 类名。例如:
<el-menu :default-active="1" mode="horizontal"> <el-menu-item index="1" is-active>菜单项 1</el-menu-item> <el-menu-item index="2">菜单项 2</el-menu-item> </el-menu>
添加上述 CSS 样式和类名后,选中菜单项的下划线将被去除,呈现出更加清爽简洁的效果。
以上就是如何去除 ElementUI 菜单栏下划线?的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号