25

The standard .tooltip from twitter bootstrap has a transparency that I would like to remove.

This my HTML:

<a href="#" class="btn
btn-info" 
style="margin:10px;" 
data-toggle="tooltip" 
data-placement="bottom" 
data-html="true"
title="MERKNAD 1 Denne klassifiseringen er i henhold til NS-EN 13501-2. <br /><br /> MERKNAD 2 Valgene 11-16 gjelder bærende konstruksjoner, valgene 21-24 gjelder kun integritet, valgene 31-37 gjelder både integritet og isolasjon, valgene 41-46 gjelder bærende skiller konstruksjoner med isolasjonskrav, og valgene 51-54 gjelder seksjoneringsvegger og dekker.">Hover</a>

CSS:

.tooltip > .tooltip-inner {
    border: 1px solid;
    padding: 10px;
    max-width: 450px;
    color: black;
    text-align: left;
    background-color: white;
    background: white;
    opacity: 1.0;
    filter: alpha(opacity=100);
}
.tooltip > .tooltip-arrow {
    border-bottom-color: black;
}

Also I made a JSFiddle to illustrate, here: https://jsfiddle.net/fiddlejan/xpwhknja/

If you hover over the button you can see how the transparent tooltip text is also showing the text underneath.

I tried:

opacity: 1.0;
filter: alpha(opacity=100);

But it does't seem to work...

Leistungsabfall
  • 6,368
  • 7
  • 33
  • 41
ganjan
  • 7,356
  • 24
  • 82
  • 133

9 Answers9

29

Bootstrap v4.0:

.tooltip.show {
    opacity: 1;
}
galengodis
  • 901
  • 1
  • 9
  • 18
28

Add .tooltip.in{opacity:1!important;} in css..By default it is 0.9 that's why background is transparent jsfiddle

Dhara
  • 1,914
  • 2
  • 18
  • 37
10

Add to your .tooltip class also opacity 1, but with flag important. See updated Fiddle

And in your fiddle you connected bootstrap.min.css directly in html. So in your website you can write

.tooltip.in {
  opacity: 1;
  filter:alpha(opacity=100);
}

without any !important and it will work. But in fiddle it doesn't work because you didn't use for that css External Resources

Its because in your bootstrap.css you have

.tooltip.in{filter:alpha(opacity=90);opacity:.9}
Narek-T
  • 1,898
  • 10
  • 20
  • You should use any more specific rule instead of using `!important` statement – A. Wolff Jan 29 '16 at 11:41
  • Surely you can override it with a parent element selector rather than !important – ShaneQful Jan 29 '16 at 11:44
  • 1
    @A.Wolff, @ShaneQful, you're right. But note, topic starter placed links directly to `` in JSFiddle. If connect that styles normally, with `external resources` so no need for '!important'. – Narek-T Jan 29 '16 at 11:50
3

Please use !important on opacity like-

.tooltip > .tooltip-inner {
  border: 1px solid;
  padding: 10px;
  max-width: 450px;
  color: black;
  text-align: left;
  background-color: white;
  background: white;

  opacity: 1.0;
  filter: alpha(opacity=100);
} 

.tooltip > .tooltip-arrow { border-bottom-color:black; }

.tooltip.in {
  opacity: 1 !important;
  filter: alpha(opacity=100);
}
Govind jha
  • 400
  • 3
  • 16
3

When I needed to reduce the transparency of the tooltip provided by ngbTooltip this is what I added in my CSS file.

Note: I was using Bootstrap v4

::ng-deep .tooltip.show {
    opacity: 1!important;
}
Steffi Keran Rani J
  • 3,667
  • 4
  • 34
  • 56
2

If you are using SCSS and Bootstrap 4 you can simply override the $tooltip-opacity variable as follows:

$tooltip-opacity: 1;
Matt
  • 1,446
  • 19
  • 17
1

Add this class :

.tooltip.in {
    opacity: 1 !important;
}
1

You will need to be specific as the exact call is two classes in one element

    .tooltip.in{
opacity: 0.9;
}

in boostrap.min.css

So just override with opacity of 1;

Hope this helps, if not you will need !important or another parent element in front - but cant see your loading order on the page so not sure on precedence.

Jamie Paterson
  • 426
  • 3
  • 10
0

Try this:

.tooltip {
  opacity: 1 !important;
}
Tyler2P
  • 2,324
  • 26
  • 22
  • 31
spidey
  • 378
  • 3
  • 8