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

前端 未结 8 1722
小蘑菇
小蘑菇 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:50

    After perusing this myself (Using the Text Color Classes in Connor Leech's answer)

    Be warned to pay careful attention to the "navbar-text" class.

    To get green text on the navbar for example, you might be tempted to do this:

    
    

    This will NOT work!! "navbar-text" overrides the color and replaces it with the standard navbar text color.

    The correct way to do it is to nest the text in a second element, EG:

    
    

    or in my case (as I wanted emphasized text)

    
    

    When you do it this way, you get properly aligned text with the height of the navbar and you get to change the color too.

提交回复
热议问题