Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove outline appeared on click in Bootstrap UI Accordion

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>
like image 316
etaiso Avatar asked May 14 '15 12:05

etaiso


People also ask

How do I make my accordion open by default?

If you are using bootstrap accordion and want that one of the accordion should be opened for the first time so add class="in" .

How do I close all accordion in bootstrap?

Just add data-toggle="collapse" and a data-target to the element to automatically assign control of one or more collapsible elements. The data-target attribute accepts a CSS selector to apply the collapse to. Be sure to add the class collapse to the collapsible element.

How do I make accordion open by default in bootstrap?

Just add data-toggle="collapse" and a data-target to element to automatically assign control of a collapsible element. The data-target attribute accepts a CSS selector to apply the collapse to. Be sure to add the class collapse to the collapsible element. If you'd like it to default open, add the additional class in.


1 Answers

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.

like image 154
lukkea Avatar answered Sep 28 '22 07:09

lukkea