views:

321

answers:

1

Hello all,

I have two elements on the same page that are using the same stylesheet: Jquery Tabs and Jquery Slider.

I cannot redefine classes of slider since change of css will affect both elements.

Tabs using these classes:

ui-tabs ui-widget ui-widget-content ui-corner-all

And these are used in Slider:

ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all

How can I modify slider css without modifying one for tabs?

Thanks

+1  A: 

Tell your styles what to do :)

css

.ui-slider{
 /* regular used in other areas etc, etc */
}

#mySlider.ui-slider {
/* forced styles, whatever, etc, etc */
}

or use classnames for multiple sliders , like:

.customSlider.ui-slider {

}
.customSlider.ui-corner-all {

}

html

<div id="mySlider" class="slider"></div>
or
<div class="customSlider"></div> 

I should specify on the css:

You can specify more than one qualifier for selectors.. css like this:

#idOfElement.classname {
 /* will only match items with id of "idOfElement" and class of "classname"
  <div id="idOfElement" class="classname" ></div> */
}

div.classname.classname2 {
  /* will only match divs with both classnames:
   <div class="classname classname2" ></div> */
}

hopefully that gives you a good idea of what's going on...

Dan Heberden
Thanks Dan! I just redefined all classes for slider. Everything works well:#slider.ui-slider #slider.ui-slider-horizontal #slider.ui-widget #slider.ui-widget-content #slider.ui-corner-all
Kelvin