1

I'm editing a website and the bootstrap code is getting in my way. There is a line in the bootstrap css that says:

.navbar .container {
    width: auto;
}

If I turn the width code off in my browsers Inspect Element, then the page looks as it should. How can I write this in my css file to override it? I need it to keep it's original settings, so I can't put 100% or a specific number in there. I've also tried inherited, initial and none suggestions.

I basically want it to disable the bootstrap css without having to remove it from the bootstrap code itself.

Nicole
  • 123
  • 3
  • 16
  • [like this](http://stackoverflow.com/questions/8084964/how-to-overwrite-styling-in-twitter-bootstrap) – Matt Feb 19 '16 at 21:56
  • 1
    The default value for width is auto. – MortenMoulder Feb 19 '16 at 21:56
  • show us your class and the html you are trying to change – Hassan Khallouf Feb 19 '16 at 22:09
  • The html that I'm trying to change is in the question. That's literally all there is. I don't have that call in my css at all, but I'm putting it in to try to override it. I just don't know what to set it to. Like I mentioned, if I turn off that line in the inspect element in my browser, things go back to the way they should be. – Nicole Feb 19 '16 at 22:12

1 Answers1

0

If I understood corectly - you want to force css systems to hear your command first and next - the bootstraps.

You can archieve that in the specification tree.

I am calling specification tree the selectors, css sorts the properties overriding by the "power" of selector.

For example:

.class_A .class_B { prop: value1; } /* weaker than */
.class_A > .class_B { prop: value2; } /* stronger one */

You can add for example to .class_B class .class_C, here I dont know what will happen, but I know this is stronger than .class_A .class_B

.class_A .class_B.class_C
.class_A > .class_B.class_C /* probably even stronger */

Summary:

If you want to override specific elements, just add class .over (override) to the DOM Elements and then you can use it in css to gain enough power to force your way of style.

Have a nice day!

Daniel Mizerski
  • 1,123
  • 1
  • 8
  • 24
  • Thanks, but I'm actually asking what I can set width to so that it uses the code that's already on the page, rather than the bootstraps width: auto. – Nicole Feb 22 '16 at 14:59