What does multiple class definition mean and how is it supposed to work?

I am trying to debug a jqueryui css issue which has led me to this question -

We find that in jqueryui css, there are class definitions such as follows :

.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 3px solid transparent; background: #FFF 0px 0px; font-weight: bold; color: White; }

Now, notice there is no comma between ui-widget-content and ui-state-default. What does this class definition mean?

if I define .ui-button .ui-widget-content .ui-state-default should it override the above definition if a .ui-button actually precedes the others in the class attribute of the element?

-------------Problems Reply------------

It is the hierarchical selector.

.ui-widget-content .ui-state-default

Means select all those child elements with the class ui-state-default whose parent has the class ui-widget-content.

I am writing an example for you to grasp it by seeing it in action.

1. Markup

<div class="ui-tabs">
<div class="ui-widget-content">
<div class="ui-state-default"></div>
<div class="ui-state-default"></div>

<div class="ui-button">
<div class="ui-widget-content">
<div class="ui-state-default"></div>
<div class="ui-state-default"></div>

2. CSS

.ui-widget-content .ui-state-default{
background-color: red;
border: 1px solid black;
display: block;
height: 100px;
width: 100px;

.ui-button .ui-widget-content .ui-state-default{
background-color: green;
border: 3px dashed yellow;

3. Explanation

All DIVs with the class ui-state-default that have a parent with the class ui-widget-content will have applied all the properties of the first CSS rule, except those DIVs whose parent has the class ui-parent, whose background-color rule will be overwritten.

Category:css Views:0 Time:2011-09-13

Related post

  • "Too many computers" error after upgrade and multiple reinstalls of Win7. What am I supposed to do? 2013-05-11

    For whatever reason, the error message doesn't include any support information at all, so I'm at a loss. Since I've only installed it on this PC (somewhat irksome that Windows 7 is happy to work with me yet Zune locks me out) so the error message and

  • Are Multiple singleton instances possible in a shared DLL? 2010-04-13

    I am going to develop a DLL for an MFC Application, and suppose I have a singleton class in this DLL with some synchronization mechanism. And this DLL is used by other processes, namely EXEs. The question is: is this singleton created only once for a

  • How do Java Interfaces simulate multiple inheritance? 2010-08-24

    I am reading "The Java Tutorial" (for the 2nd time). I just got through the section on Interfaces (again), but still do not understand how Java Interfaces simulate multiple inheritance. Is there a clearer explanation than what is in the book? -------

  • Maintaining multiple workspaces for each build in Hudson 2010-08-26

    Is it possible to maintain multiple workspaces for each build in Hudson? Suppose if i want to keep the last 5 builds, is it possible to have the five corresponding workspace folders also? Currently whenever a new build is scheduled it overwrites the

  • Loading multiple versions of the same library 2011-02-09

    I'm using a library, Zend Framework in this and it has the path ZendFramework-1.10.8/library/Zend/ I load it in index.php realpath(CENTRAL_LIBS_PATH . '/ZendFramework-1.10.8/library'), // /Zend left out and so can call one of its classes class with Z

  • How to handle android tabHost tab with multiple activities within single tab 2011-05-02

    Could anyone assist me with tabHost? I want a solid tutorial with demo examples for managing multiple activities under a running tab. Suppose tab1 is setcontent with some "Activity A". In "Activity A" I want to start some other activities that should

  • In Cocoa do you prefer NSInteger or int, and why? 2008-08-17

    NSInteger/NSUInteger are Cocoa-defined replacements for the regular built-in types. Is there any benefit to using the NS* types over the built-ins? Which do you prefer and why? Are NSInteger and int the same width on 32-bit / 64-bit platforms? ------

  • Postgresql Concurrency 2008-11-25

    In a project that I'm working, there's a table with a "on update" trigger, that monitors if a boolean column has changed (ex.: false -> true = do some action). But this action can only be done once for a row. There will be multiple clients accessi

  • Java - Collection Selection 2009-07-15

    What generics collection class can I use that provides both mapping and array-like functionality. For example, I want to map a String to a Double and I want to reference the value using the key as the index. collection[key] = collection[key] + double

  • LL(1) cannot be ambiguous 2010-04-17

    How can it be shown that no LL(1) grammar can be ambiguous? I know what is ambiguous grammar but could not prove the above theorem/lemma. --------------Solutions------------- I think it's nearly a direct result of the definition of LL(1). Try proof b

  • Custom Wordpress index.php which circumvents The Loop isn't working correctly 2010-07-28

    I'm building a Wordpress theme for a client and it's unlike any other theme I've built before in that the homepage is a collection of posts spread across multiple different containers and styles. It's supposed to look and feel like a magazine in that

  • Comparing algorithm complexity 2010-08-10

    Please, help me to compare complexity of two algorithms. O(N+1000) + O(M*log(M)) O(N*5) + O(2000) N = 100000 M = 100 I can't understand, what should I do with O(...)? Can I leave it? And just do... (N+1000) + (M*log(M)) = 101200 (N*5) + 2000 = 502000

  • Replace Button Text With Image? 2010-08-15

    I'm trying to find out how to replace the input text with a image. I can't use background: url(.../.../); because I am using CSS3 Gradients. I thought with using multiple backgrounds I am able to add another one that has a transparent image but then

  • WCF Service Reference in ASP.net Page - When to Dispose? 2010-08-31

    I have an ASP.net page that is creating a service reference to a WCF service and making calls in multiple places in my page. I instantiate the service reference in Page_Load and have an instance variable to store it: private FooClient _serviceClient;

  • In Rails, if "gem install ___" installs 6 gems total, will installing as plugin require installing the other 5 gems manually? 2010-10-19

    If installing a gem using gem install ______ actually install 6 gems, because of the dependencies, then if the gem is installed as plugin by script/plugin install git://github.com/author/____.git or script/plugin install _____ then we to manually ins

  • How To Create a Complex Table in sqlServer? 2010-10-31

    Lets say I have a table called Employees , and each employee has a primarykey called (E_ID) and I have another table called Positions , and each Position has a primarykey called (P_ID) and I also have another table called offices , and each office ha

  • OpenGL update rate in Qt 4 2010-12-13

    I'm developing an application in Qt 4.7 which makes use of OpenGL. I know updateGL() must be called in order to refresh the view, making a swap from the backbuffer but, how often should it be done? It should be done as frequently as possible because

  • How to find all squares in the number (Java)? 2011-02-12

    I seem to have a mental block, and cannot progress with the following problem. Basically, I want to find all possible squares in a given number, i.e. N = S*S*A, where N in given number, S*S is a square, and A is some other number. And I need to find

  • Eagerly Disposing a ManualResetEvent 2011-06-07

    I have a class which allows other threads to wait until it finishes an operation using a ManualResetEventSlim. (The operations are typically brief) This class has no explicit lifetime, so there is no single place that I can easily close the event. In

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.206 (s). 11 q(s)