What is the proper way to override an element's CSS 'position: relative;' using Boots


I am working on a project using the Twitter Bootstrap 2.2.1 Initializr boilerplate. In order to properly override Bootstrap's default CSS attributes you need to create an entry for the affected class in 'main.css' and add the desired attributes.

In this particular case Bootstrap has a class called '.collapse' that is applied to the default navbar.

.collapse{ position:relative; height:0; overflow:hidden; -webkit-transition:height .35s ease; -moz-transition:height .35s ease; -o-transition:height .35s ease; transition:height .35s ease }

The portion that is causing problems for me is the 'position: relative;'. I need there to be no position statement. Now I know that I can just open the Bootstrap CSS file and edit it but if the file gets updated that change will be lost.

What is the proper way of overriding this CSS entry?


Include your own CSS file after bootstrap.css and write a rule with the same selector. As for the position property, you could use position: static; or whatever you'll need.


If is just one property you can add inline css to the html element and reset the position property to his default value:

<nav class="collapse" style="position:static"> <ul> <li>....</li> <li>....</li> </ul> </nav>

But if you think you will change/add others styles, then you should add your own CSS file after bootstrap.css, with that all your styles will override the bootstrap default css.


  • Kafka-docker: can't produce messages
  • Android OpenGL 2.0 Low FPS
  • Add new column attribute to the shapefile and save it to database using Geotools Java
  • How to set the minimum SDK Build Tools version required in an Android Studio project?
  • TeamCity: Scripting elements jsp:declaration, jsp:expression, jsp:scriptlet are disallowed here
  • Trouble using Runtime.getRuntime().exec
  • disable EJS caching in production
  • Encode string to Base64 in Inno Setup (Unicode Version of Inno Setup)
  • SQLITE multiple table join with a condition
  • API Gateway Encoding multipart/form-data
  • Multithread python requests [duplicate]
  • How to manipulate content of a comment with Apache POI
  • Dynamically change JavaFX css property
  • How to get a time and Date Separately?
  • PHP: Need to close STDIN in order to read STDOUT?
  • Fortran function variable length string return
  • Windows biometric framework sample umdf driver: This device cannot start. (Code 10)
  • Swift manually rotate view controller
  • Facebook Error (#200) The user hasn't authorized the application to perform this action (PHP)
  • Compiling multiple source files in Rcpp
  • How to resolve this in PHPUnit where it is asking me to set KERNEL_DIR in my phpunit.xml?
  • How to create subsets of a single set of elements with XSLT?
  • Multiplying polynomials/simplifying like terms
  • Tensorflow Dataset API restore Iterator after completing one epoch
  • Floating parent div grows to hypothetical width of floating child div
  • how to snap two objects in runtime in unity?
  • Android: Unable to detect vertical plane
  • Will this work on all screen sizes?
  • How to integrate angular2-material (alpha 8.2) with angular2-Quickstart app
  • Send array to next viewcontroller iOs xcode [duplicate]
  • Bind selectedDates Aggregation for Calendar
  • Debug `Unexpected end of JSON input Error` on content script
  • Comma decimal separator is ignored by ASP.NET MVC model binder
  • Excel VBA : conditional formatting of sheet1 cells from sheet2 values in excel 2007
  • Codeigniniter insert data through models and controller
  • Call Microservice from another Microservice within Docker
  • Sign a Pdf using custom digital signature in Java
  • PHP Permalinks.. how to change?
  • Running R's aov() mixed effects model from Python using rpy2
  • What does the “id” field in an Android “Google Play Music” broadcast intent correspond to?