【发布时间】:2020-03-26 15:26:49
【问题描述】:
我正在使用 bootstrap-vue 制作导航菜单,如下所示:(直接取自文档)
<b-navbar toggleable="lg" type="light" variant="light">
<b-navbar-brand href="#">NavBar</b-navbar-brand>
<b-navbar-toggle target="nav-collapse"></b-navbar-toggle>
<b-collapse id="nav-collapse" is-nav>
<!-- Right aligned nav items -->
<b-navbar-nav class="ml-auto">
<b-nav-item-dropdown text="Lang" right>
<b-dropdown-item href="#">EN</b-dropdown-item>
<b-dropdown-item href="#">ES</b-dropdown-item>
<b-dropdown-item href="#">RU</b-dropdown-item>
<b-dropdown-item href="#">FA</b-dropdown-item>
</b-nav-item-dropdown>
<b-nav-item-dropdown right>
<!-- Using 'button-content' slot -->
<template v-slot:button-content>
<em>User</em>
</template>
<b-dropdown-item href="#">Profile</b-dropdown-item>
<b-dropdown-item href="#">Sign Out</b-dropdown-item>
</b-nav-item-dropdown>
</b-navbar-nav>
</b-collapse>
</b-navbar>
这次我想稍微改变一下这个组件已经拥有的样式,在这种情况下,当从菜单的下拉列表中传递光标时的背景颜色,我有这样的东西:
<style scoped>
.dropdown-item:hover, .dropdown-item:focus {
color: #ffffff;
text-decoration: none;
background-color: #dd4343;
}
</style>
但这不起作用,那么编辑这些样式的正确方法是什么?
【问题讨论】:
-
你试过把重要的放在一边吗?
-
使用浏览器的开发工具检查您的样式未应用的原因。使用 CSS,通常是由于特殊性。即,Bootstrap CSS 选择比你的更具体
标签: css vue.js bootstrap-4 bootstrap-vue