search

Home  >  Q&A  >  body text

css3 - 自己写的CSS与使用的框架冲突如何解决呢?

例如我自己有个css的文件叫做style.css,我的项目中也用到了Bootstrap框架,但是其中一些标签的定义有冲突、因为一开始的时候项目中用的是style.css,Bootstrap框架是后来引入到项目中的,那么有什么办法能够避免这种冲突呢?引入了Bootstrap框架后,原有的有些页面样式就不对了、

ringa_leeringa_lee2782 days ago669

reply all(1)I'll reply

  • 阿神

    阿神2017-04-17 11:32:49

    Generally, when you decide to introduce a certain framework, you need to focus on the style sheet of this framework and make some detailed adjustments on this basis. In other words, your style.css may need to be changed.

    Of course, you can also consider changing the style in the bootstrap source file, but it is not recommended to change the structure. It is still possible to only change some color matching, border effects, etc. Changing the structure may cause layout confusion.

    If you need to use two style sheets in different places on a page, you can consider adding restrictions by region. Of course, in this case, it is best to change your own style.css and put it in the bootstrap style sheet. Import it later, such as

    Original

    a {}
    .abcd {}

    Add a restriction (you also need to add a p.mime in the HTML to wrap it up (I wrote LESS to make it easier to see the hierarchical relationship)

    // less file
    .mine {
        a {}
        .abce {}
    }

    reply
    0
  • Cancelreply