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

半腔热情 提交于 2019-12-29 09:32:28

问题


I'm using two jquery ui widgets, autocomplete and tabs.

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. When I make a change to the styles in jquery.ui.theme.css it affects both the autocomplete and the tabs. 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

.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.


回答1:


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

edit:

from jquery ui tabs documentation

Your rendred html will look like:

<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 } 


来源:https://stackoverflow.com/questions/9317380/how-can-i-style-jquery-ui-autocomplete-differently-than-jquery-ui-tabs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!