With Twitter Bootstrap, how can I customize the h1 text color of one page and leave the other pages to be default?

前端 未结 8 1614
小蘑菇
小蘑菇 2021-01-31 18:00

On my index page, I want the h1 text color to be white and comes with shadow, but I don\'t want to change the default behavior the h1 on other pages. How can I achieve this?

相关标签:
8条回答
  • 2021-01-31 18:39

    in bootstrap 3 here are the classes to change the text color:

    <p class="text-muted">...</p> //grey
    <p class="text-primary">...</p> //light blue
    <p class="text-success">...</p> //green
    <p class="text-info">...</p> //blue
    <p class="text-warning">...</p> //orangish,yellow
    <p class="text-danger">...</p> //red
    

    Documentation under Helper classes - Contextual colors.

    0 讨论(0)
  • 2021-01-31 18:40

    There are helper classes in bootstrap 3 with contextual colors please use these classes in html attributes.

    <p class="text-muted">...</p>
    <p class="text-primary">...</p>
    <p class="text-success">...</p>
    <p class="text-info">...</p>
    <p class="text-warning">...</p>
    <p class="text-danger">...</p>
    

    Reference: http://getbootstrap.com/css/#type

    0 讨论(0)
  • 2021-01-31 18:41

    In addition to @Connor Leech's answer.

    If you want to create a new custom typography type of your own, define the following in your css file.

    .text-foo {
      .text-emphasis-variant(#FFFFFF);
    }
    

    The mixin text-emphasis-variant is defined in Bootstrap's mixins.less file.

    0 讨论(0)
  • 2021-01-31 18:41

    The best way to solve this problem would be by starting with customizing Bootstrap using their customization tools.

    http://getbootstrap.com/customize/

    Go down to @headings-color and change it from "inherit" to something that you would like your headers to be across the site (if you like the default just change it to #333).

    Note that this will keep all your headings the same color, as you requested.

    Now in order to accomplish what you want that after you make this change you can now overwrite them specifically in your own CSS to apply your own color to them. The "inherit" keyword I always have found to be a pain in frameworks.

    0 讨论(0)
  • 2021-01-31 18:47

    You can also apply the default 'text' classes available from bootstrap itself

     <h1 class='text-info'>Hey... I'm blue</h1>
    

    http://twitter.github.io/bootstrap/base-css.html

    0 讨论(0)
  • 2021-01-31 18:47

    you could use the font style Like:

         <font color="white"><h1>Header Content</h1></font>
    
    0 讨论(0)
提交回复
热议问题