2017-05-23 180 views
0

我是bootstrap新手,我想用css3的知識,當你想改變一個字體的顏色,你給一個類或id的部分或任何目標,然後改變你的字體。我正在使用預建的navBar並試圖做同樣的事情,但它不起作用。有人可以幫助我不僅答案,但解釋如何將我的鏈接的所有頂部目標更改爲白色的字體顏色。BootStrap4字體顏色

<!DOCTYPE html> 
<html lang="en"> 
    <head> 
     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous"> 



     <title>Richard Jimenez Portfolio</title> 

      <style type="text/css"> 
       #myList{ 
        font:white; 
       } 


      </style> 

     </head> 

    <body> 

    <header> 
      <nav class="navbar navbar-toggleable-md navbar-light bg-faded"> 
      <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> 
      <span class="navbar-toggler-icon"></span> 
      </button> 

     <a class="navbar-brand" href="#">MyApp</a> 

     <div class="collapse navbar-collapse" id="navbarSupportedContent"> 
     <ul class="navbar-nav mr-auto" id="myList"> 
      <li class="nav-item active"> 
      <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a> 
      </li> 
      <li class="nav-item"> 
      <a class="nav-link" href="#">Experience</a> 
      </li> 
      <li class="nav-item"> 
      <a class="nav-link" href="#">Projects</a> 
      </li> 
      <li class="nav-item"> 
      <a class="nav-link" href="#">Resume</a> 
      </li> 
      <li class="nav-item"> 
      <a class="nav-link" href="#">Contact</a> 
      </li> 
     </ul> 
     <form class="form-inline my-2 my-lg-0"> 
      <input class="form-control mr-sm-2" type="text" placeholder="Search"> 
      <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button> 
     </form> 
     </div> 
    </nav> 
    </header> 
     </body> 
    </html> 

回答

1

你一定要上的元素你的目標

#myList a { 
    color: white; 
} 
+0

更具體的我已經試過了,它仍然不工作... –

+0

你有沒有注意到對CSS的變化財產?這不是「字體」,而是「顏色」。在我給你的例子中,鏈接「Home」,「Experience」,「Projects」,「Resume」和「Contact」變成白色;) – AirBair

+0

哈哈謝謝!現在去喝我的咖啡 –