17

I'm trying to use angular-ui bootstrap accordion to hold bootstrap table inside the heading. When user clicks on the accordion heading and it opens, a strange outline appears. It looks like this (the light blue rectangle around "Some title"): enter image description here

I understand it happens because I used the <div> , but how can I eliminate this behavior?

The code is:

<accordion close-others="true">
  <accordion-group>
    <accordion-heading>
      <div>Some title</div>
    </accordion-heading>
    Text
  </accordion-group>
  <accordion-group>
    <accordion-heading>
      <div>Another title</div>
    </accordion-heading>
  </accordion-group>
</accordion>
etaiso
  • 2,736
  • 3
  • 26
  • 38

7 Answers7

18

The outline is added to the panel-heading panel-title <a> tag, which has an .accordion-toggle class. So, to avoid the * catch-all selector you can do this:

.accordion-toggle:focus{outline: none;}

With this solution there is no need for !important either (so you'll respect the devs who come after you).


outline is a shorthand property whose only required value is outline-style. In this case I am setting outline-style to none.


This is a great article that explains specificity, if you're not convinced that !important should be avoided in all but a couple of cases.

lukkea
  • 3,606
  • 2
  • 37
  • 51
4

Try with:

accordion * {outline: 0 !important;}

Modifying etaiso comment

Community
  • 1
  • 1
r1ckr
  • 5,643
  • 5
  • 20
  • 24
2

try to add a class inside the title div like:

<div class="title-div">

then on css, try with:

.title-div:focus {outline: 0 !important;}
J. Liu
  • 21
  • 1
0

try this

.accordion-heading:focus{outline:0;border:none;}
Vicky
  • 358
  • 2
  • 15
  • 1
    It didnt work.. I found that `html * {outline: 0 !important;}` did the work, but there must be more elegant way. need to find the exact css selectors for this. – etaiso May 14 '15 at 12:40
  • That's what I said, but I don't think it's a bad practice as it overrides all classes – etaiso May 14 '15 at 12:46
0

Try this it worked for me

.ng-scope .accordion-toggle  { outline: 0 !important;}
0

try this:

.accordion-toggle:hover, .accordion-toggle:focus, .accordion-toggle:active{

    text-decoration: none;
    outline-style: none;
}
anudeep b
  • 391
  • 2
  • 6
0

100% work will be :

a:focus, a:hover {
  color: #23527c;
  text-decoration: none;
}