How can I override Bootstrap CSS styles?

前端 未结 12 1075
囚心锁ツ
囚心锁ツ 2020-11-22 05:35

I need to modify bootstrap.css to fit my website. I feel it\'s better to create a separate custom.css file instead of modifying bootstrap.css

12条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 06:16

    1. Inspect the target button on the console.
    2. Go to elements tab then hover over the code and be sure to find the default id or class used by the bootstrap.
    3. Use jQuery/javascript to overwrite the style/text by calling the function.

    See this example:

      $(document).ready(function(){
          $(".dropdown-toggle").css({ 
            "color": "#212529",
            "background-color": "#ffc107",
            "border-color": "#ffc107"
           });
          $(".multiselect-selected-text").text('Select Tags');
      });
    

提交回复
热议问题