<分区>
<分区>
如何在不影响选项卡本身文本的情况下降低导航栏中选项卡背景的不透明度? 例如,文本“关于我们”的不透明度为 1,但背景颜色的不透明度为 0.5。 这是我的 CSS 代码。
.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus{
color: #FFFFFF;
background-color: #009eff;
}
最佳答案
您应该使用 rgba
颜色格式而不是 hex
。使用:
背景颜色:rgba(0, 158, 255, 0.5);
这是来自 Mozilla 开发者网站的 rgba
的定义:
Colors can be defined in the Red-green-blue-alpha model (RGBa) using the rgba() functional notation. RGBa extends the RGB color model to include the alpha channel, allowing specification of the opacity of a color.
a means opacity: 0=transparent; 1=opaque;
关于CSS 改变选项卡背景的不透明度而不影响选项卡上的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32670212/