-1

I have given HTML page and I'm not allowed to change the html code(e.g. extend the html elements with IDs etc.). I'm only allowed to change the layout by using the existing element classes, IDs etc. The element for which I want to change the text properties has the class .requestStatus and is in a table call, but this is not the only element, which have this css class. How can I select only the elements bordered with green and not the elements that are bordered in red?

enter image description here

user615993
  • 185
  • 3
  • 15

2 Answers2

1

The :not(...) selector is what you're looking for:

CSS:

<style>
    tr:not(tr>th) span.requestStatus { }
</style>

jQuery:

var selected_objects = $("tr:not(tr>th) span.requestStatus");

If you provide more details, as to what you're trying to actually "do" with each element, it would be easier to give additional instructions.

InfiniteStack
  • 430
  • 2
  • 9
  • A tr is not a th, so your use of the :not() selector here is meaningless. (Also, the extended :not() syntax is [not supported in CSS in most browsers](http://stackoverflow.com/questions/35993727/not-selector-not-behaving-the-same-between-safari-and-chrome-firefox).) – BoltClock Jan 26 '17 at 02:42
  • tr:not(tr>th) span.requestStatus { } didn't work. I used instead the fact, that the td span.requeststatus is allways into a . So this worked fine tr.listRowOdd span.requestStatus{ } – user615993 Jan 26 '17 at 14:04
0

Try this :

1) Only Span element has class requestStatus :

td span.requestStatus{
    *Css Code;*
}

2) all Elements with class requestStatus Except img element

td .requestStatus:not(img){
    *Css Code;*
}
Ehsan
  • 12,655
  • 3
  • 25
  • 44