• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

What in bootstrap css is this style called

Enthusiast ,
May 15, 2020 May 15, 2020

Copy link to clipboard

Copied

Hi all, I am struggling to find a style in bootstrap css so I can override it. Could somebody please let me know what I need to look for, pleasse?

 

It's in the navbar where it has sub or child dropdown nav items, and it's when you click on the child item to move to another page it's background changes colour, on click but not released the click. Basically, it has a blue background which doesn't go with the rest of the site's colour scheme, and it's annoying me:

 

Screenshot 2020-05-15 at 11.46.38.png

 

Thanks in advance.

TOPICS
Bootstrap

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , May 15, 2020 May 15, 2020

It is the css selector below.

 

.dropdown-item.active, .dropdown-item:active {
color: #fff;
text-decoration: none;
background-color: #007bff;
}

 

Change  the background color:

.dropdown-item.active, .dropdown-item:active {
background-color: tomato;
}

 

Drop the css selector above into your OWN css stylesheet and link it AFTER the link to the default Bootstrap css file - change the background-color to the color you require.

 

I'm not sure why the browser inspector shows the class as being duplicated:

 

.dropdown-

...

Votes

Translate

Translate
LEGEND ,
May 15, 2020 May 15, 2020

Copy link to clipboard

Copied

It is the css selector below.

 

.dropdown-item.active, .dropdown-item:active {
color: #fff;
text-decoration: none;
background-color: #007bff;
}

 

Change  the background color:

.dropdown-item.active, .dropdown-item:active {
background-color: tomato;
}

 

Drop the css selector above into your OWN css stylesheet and link it AFTER the link to the default Bootstrap css file - change the background-color to the color you require.

 

I'm not sure why the browser inspector shows the class as being duplicated:

 

.dropdown-item.active, .dropdown-item:active

 

You could just use:

 

.dropdown-item:active {

 

}

 

 

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
May 15, 2020 May 15, 2020

Copy link to clipboard

Copied

Thank you very much! I was looking at the :focus rather than :active.

 

I always thought :active referred to the page you're on... I've learnt something new today

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 15, 2020 May 15, 2020

Copy link to clipboard

Copied

"I'm not sure why the browser inspector shows the class as being duplicated"

Not duplicated.  Dot = class.  Colon = pseudo-class.  Bootstrap uses both.

.active, :active

 

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 16, 2020 May 16, 2020

Copy link to clipboard

Copied

LATEST

My eyes missed that........only use whats specifically needed would be my advice but thats lost on anyone using Bootstrap of course.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines