简体   繁体   English

如何设置与jQuery-UI选项卡不同的jQuery-UI自动完成样式?

[英]How can I style jQuery-UI autocomplete differently than jQuery-UI tabs?

I'm using two jquery ui widgets, autocomplete and tabs. 我正在使用两个jquery ui小部件,自动完成和选项卡。

They each have their own stylesheets in jquery.ui.autocomplete.css and jquery.ui.tabs.css respectively, however they share a lot of styles in jquery.ui.theme.css . 他们每个人都有自己的样式表jquery.ui.autocomplete.cssjquery.ui.tabs.css分别,但他们分享了很多的风格jquery.ui.theme.css When I make a change to the styles in jquery.ui.theme.css it affects both the autocomplete and the tabs. 当我更改jquery.ui.theme.css的样式时,它会影响自动完成功能和选项卡。 How can I customize the styles different for autocomplete and tabs? 如何自定义与自动完成和制表符不同的样式?

One thing I would like to change is the rounded edges on the background hover effect for the autocomplete. 我要更改的一件事是自动完成的背景悬停效果上的圆形边缘。 The proper .css change to this is 正确的.css更改为

.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 0px; -webkit-border-top-left-radius: 0px; -khtml-border-top-left-radius: 0px; border-top-left-radius: 0px; }

However I would like the tabs to be rounded. 但是,我希望将选项卡四舍五入。 So the change I would make is change the radius from 0px to 5px . 所以我要进行的更改是将半径从0px更改为5px

Put style which you want to customize, for example at head section like below: 您想要自定义的样式,例如在下面的标题部分:

#my-tab .ui-corner-all, #my-tab .ui-corner-top, #my-tab .ui-corner-left, #my-tab .ui-corner-tl { -moz-border-radius-topleft: 0px; -webkit-border-top-left-radius: 0px; -khtml-border-top-left-radius: 0px; border-top-left-radius: 0px; }

my-tab being your jquery-ui tab div id my-tab是您的jquery-ui选项卡div ID

edit: 编辑:

from jquery ui tabs documentation jQuery ui选项卡文档

Your rendred html will look like: 您提交的html如下所示:

<div class="ui-tabs ui-widget ui-widget-content ui-corner-all" id="tabs">
   <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
     <li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#tabs-1">Nunc tincidunt</a></li>
      <li class="ui-state-default ui-corner-top"><a href="#tabs-2">Proin dolor</a></li>
   <div class="ui-tabs-panel ui-widget-content ui-corner-bottom" id="tabs-1">
      <p>Tab one content goes here.</p>
   </div>
    ...
</div>

for "menu", you will override by: 对于“菜单”,您将通过以下方式覆盖:

#ui-tabs .ui-tabs-nav>li a { color: red !important } 

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

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