Why Bootstrap CSS is not overriding in other project with the same code?

后端 未结 3 1281
遥遥无期
遥遥无期 2021-01-25 10:23

I have such problem. I\'m working with project, but when I copy the same files from server it looks different - some Bootstrap styling is not overrided.

Here is screensh

相关标签:
3条回答
  • 2021-01-25 10:54

    Your styles are probably not overriding because you need to override several instances of a property.

    You haven't provided us with any of the code you are trying to override with, so I can't say for sure, but in the above code, you can't just override box-shadow but -webkit-box-shadow etc.

    This is much easier to do when working with the source LESS files from Bootstrap's Github project where you can define this as

    .box-shadow(1px 1px 5px #e1e1e1);
    

    And it will automatically write out all of these properties for box-shadow.

    Here are Bootstrap's instructions on how to do this: http://twitter.github.com/bootstrap/extend.html

    There's also Kickstrap, which is already set up to do this. It keeps your customizations in a separate layer from Bootstrap so you don't have to touch the source code (also other goodies).

    0 讨论(0)
  • 2021-01-25 11:07

    Try this: You should have a .scss (or .sass?) file to gather all the components. In MY case it is called styles.scss

    The order in which the elements appear in this file is important - as the first entries overwrite the later ones - in case of variables! But put your styling(!) changes after your bootstrap entry.

    My styles.scss file looks like this:

    // myVars
    @import "myvariables"; // My vars first to overwrite
    
    // This file is a starting point for the project
    @import "bootstrap";
    
    // Include my layout tweeks
    @import "assets/layout-tweaks";
    @import "assets/hero-swapper";
    @import "assets/someotherelement";
    
    // Include responsive Bootstrap styles
    @import "bootstrap-responsive";
    
    0 讨论(0)
  • 2021-01-25 11:10

    You can do common css file, where you'll import bootstrap css and other custom css in desired order. And in layout you will need to include only this common css file.

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