Changing Bootstrap's navbar opacity without affecting the buttons

余生颓废 提交于 2019-12-03 08:27:59
Arun P Johny

One solution is to use rbga as given here. It does not work in ie < 9,

.custom_nav .navbar.navbar-fixed-top .navbar-inner{
    background: rgba(255, 255, 255, 0.3);
}

Fiddle

To change the opacity of the parent without affecting the opacity of the children, use rgba on the background property, like this:

ul {
  background: rgba(255, 255, 255, 0.7);
}

The first 3 values are the RGB values that make up the color, and the last value is the opacity of the color (in the example above, the opacity is 70%).

See DEMO.

I had write a mixin with stylu:

support-for-ie ?= true

opacity(n)
  opacity n
  -moz-opacity n
  filter unquote('alpha(opacity=' + round(n * 100) + ')')
  if support-for-ie
    filter unquote('progid:DXImageTransform.Microsoft.Alpha(Opacity=' + round(n * 100) + ')')

.opacity-70
  opacity(0.7)

I hope it can help someone who want some opacity with support almost all browser thinks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!