简体   繁体   中英

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

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 .

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 } 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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