使用引导程序更改表头颜色

我有一个使用bootstrap的MVC5应用程序。 表列名称在白色背景上为黑色,我想将其更改为蓝色背景,列名称将为白色,我该怎么做? 我尝试使用CSS类没有成功…

 

在你的CSS中

 th { background-color: blue; color: white; } 

您可以简单地将其中一个引导上下文背景颜色应用于标题行。 在这种情况下(蓝色背景,白色文本):主要。

     
@Html.DisplayNameFor(model => model.name) @Html.DisplayNameFor(model => model.checkBox1)
Firstname Surname
John Doe
Jane Roe

这是分隔表头和表体的另一种方法:

 thead th { background-color: #006DCC; color: white; } tbody td { background-color: #EEEEEE; } 

看看这个例子来分离桌子的头部和身体。 JsFiddleLink

试试这个:

 table.table tr th{background-color:blue !important; font-color:white !important;} 

希望这可以帮助..

 //use css .blue { background-color:blue !important; } .blue th { color:white !important; } //html .....