How extend bootstrap classes

前端 未结 1 1304
遥遥无期
遥遥无期 2021-02-20 13:43

I am doing my first steps with Bootstrap Twitter, and need to extend components. For example, I would like to change the navbar background, but without changing the original cs

1条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-20 14:13

    There are a few ways to customize/extend Bootstrap classes which are all discussed here: Twitter Bootstrap Customization Best Practices

    If you intend to override the boostrap styles with your own custom CSS you should avoid using !important as this is generally a bad practice.

    In the case of the navbar, the element that has the background-color is navbar-inner so you'd want to override like this:

    .test .navbar-inner{
        background-color: red;
    }
    

    Custom navbar example: http://bootply.com/61032


    How to extend/modify (customize) Bootstrap 4 with SASS

    0 讨论(0)
提交回复
热议问题