简体   繁体   English

jQuery-UI选项卡-更改活动选项卡的颜色

[英]Jquery-UI Tab - Change Active Tab Color

For the tab the user clicks on an is active, I like to change the tab color. 对于用户点击的标签页,我想更改标签页的颜色。 I have the styling below. 我有下面的样式。 Is there another styling that I may be missing? 我可能会缺少其他样式吗?

I have the following code 我有以下代码

// Styling of tabs 
<style>
    .ui-tabs-active {
        background-color: green;     
    }
</style>


    // tab details
    <div id="tabs">
     <ul>
      <li><a href="#tabs-1">Tab1</a></li>
      <li><a href="#tabs-2">Tab2</a></li>
      <li><a href="#tabs-3">Tab3</a></li>
     </ul>
     <div id="tabs-1">
      <p>Tab1 Content</p>
     </div>
     <div id="tabs-2">
      <p>Tab2 Content</p>
     </div>
    <div id="tabs-3">
      <p>Tab3 Content</p>
    </div>
   </div>

// Javascript // Javascript

  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

 <script type="text/javascript">

     $(function () {
       $("#tabs").tabs();
  });
 </script>

It still shows in blue color whereas I have need it in green. 它仍然显示为蓝色,而我需要使用绿色。

在此处输入图片说明

Your green color is overridden by CSS specificity. 您的绿色被CSS特异性覆盖。 If you want to update the active tab color you need to apply the color to active under tab class 如果要更新活动标签的颜色,则需要将颜色应用于标签类下的活动标签

.ui-tabs .ui-tabs-active {
    background-color: green;
}

or you can use !important as well. 或者您也可以使用!important。

See the running code here 在这里查看运行代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM