0

I wonder why Bootstrap overrides link colors in a table? I.e.

table.table a {
    margin: 0;
    color: #212529;
}

a {
    cursor: pointer;
    text-decoration: none;
    color: #007bff;
    transition: all 0.2s ease-in-out;
}

And is it possible to prevent this behavior by adding some bootstrap class, i.e. not touching css?

alexbk66
  • 362
  • 1
  • 3
  • 12

1 Answers1

-1

First of all please fix the typos for bootstrap :) Both your title and the content have it with the wrong spelling. Using the right word will help other people find your question and the correct answer easier.

To your question:

TLDR: include bootstrap css first, then override the unwanted spec in your own css files.

Explanation:

Last included css file has the highest priority in CSS. See: Order of prioritization when using multiple contradictory css files

Meaning, if there are multiple files matching to the same specificity (same type, class, id etc.), the last file included will control the change. In general, you want to include library files like bootstrap the first; then, you need to include your own css files (generally style.css or main.css). In your files, you can override whatever you didn't like from bootstrap.

xgmexgme
  • 132
  • 7
  • Thanks for the correction, I was typing at 2 am after long battle with css. – alexbk66 Dec 26 '20 at 07:06
  • But regarding your answer - I know how to use css. But my question states explicitely - not using css. I have access to source code, but can't add any new files (i.e. css). And another reason I don't want to add my css - because bootstrap defines different colors for different link state, I don't want to copy them all, especially if some colors change (say different theme). – alexbk66 Dec 26 '20 at 07:08
  • What do you mean by “by adding some bootstrap class, i.e. not touching css”? Do you have access to html? You can open a ` – xgmexgme Dec 27 '20 at 19:50
  • As I explained above @xgmexgme - I don't want to add my own color definitions, I just want links in the table use the same colors as normal links. Otherwice I'll have to copy the colors for every link state, and possibly every theme. – alexbk66 Dec 28 '20 at 23:45