top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

What is Contextual Selector in CSS ?

0 votes
What is Contextual Selector in CSS ?
posted Mar 20, 2014 by Nikita Sehgal

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Source :
Contextual selectors provide the ability to create rules specific to certain structural circumstances. As an example, say you need strong text to appear blue but only if it's found within an h1 element.

You could use a class selector. However, adding the class attribute to every instance of the strong tag that is located inside an h1 tag is extra work. For example:

.setcolor { color: blue; }

<h1>This is <strong class="setcolor">Strong<strong> Text</h1>
answer Mar 21, 2014 by Divya Bharti
Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.