css3 - 自己写的CSS与使用的框架冲突如何解决呢?
ringa_lee
ringa_lee 2017-04-17 11:30:49
0
1
647

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

ringa_lee
ringa_lee

ringa_lee

reply all(1)
阿神

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 {}
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!