Reputation: 97
I am using jqGrid for a project and inspecting the styles it uses I find selectors such as this:
.ui-jqgrid tr.ui-row-ltr td {
...
}
.ui-jqgrid
is of course a class.
td.ui-row-ltr
is a selector for class ui-row-ltr
as applied to a table row element.
So to my questions:
.class1, .class2
means "Apply to class1 and class2", but what does space separation mean?td
at the end mean? td.class
I understand but class td
?Upvotes: 0
Views: 181
Reputation: 557
Space separation between CSS selectors means that the latter selector is a descendant of the former.
(Example: div .main
will select any .main
classes that are children (of any level) of a div
element.)
td
, here) listed is the item that will be styled.Upvotes: 2
Reputation: 609
This is basic CSS indeed. Here are some examples for you:
div.bob
selects <div class="bob">
div .bob
selects any class="bob"
elements nested inside any div:
<div><a class="bob"></div>
<div><span><a class="bob"></span></div>
div > .bob
selects direct descendants only (Ex1, but not Ex2 above)Upvotes: 6
Reputation: 1122
Imagine we have a table id="main" , which contains many tr's which have td's inside. Now, the selector "#main td" means select all the elements with the tag td that are children or children of children of the element that has the id=main, not necesarily children, but any level below
so if i have .ui-jqgrid tr.ui-row-ltr td
it means, select all the elements with tag td, that have someone above their level a parent element tr with the class ui-row-ltr, that he has above an element with the class ui-jqgrid
All this is basic css stuff, search for some tutorials to learn more http://code.tutsplus.com/tutorials/the-30-css-selectors-you-must-memorize--net-16048
Upvotes: 1
Reputation: 134
Space is known as descendent combinator this, meaning select all elements inside that element.
Upvotes: 1
Reputation: 43
Your selector will basically target every .ui-jqgrid
which has tr.ui-row-ltr
and if this passes it will apply your css properties to each td
inside
Upvotes: 1
Reputation: 3593
It is like this.
<div class="ui-jqgrid">
<table>
<tr class="ui-row-ltr">
<td>some data</td>
</tr>
</table>
</div>
or may be
<table class="ui-jqgrid">
<tr class="ui-row-ltr">
<td>some data</td>
</tr>
</table>
Upvotes: 1
Reputation: 2986
It means that the styles contained there will be applied to all td
s contained in tr
with class ui-row-ltr
that are nested inside your element with ui-jqgrid
class.
Upvotes: 1