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
170 views
What is Contextual Selector in CSS ?
posted Mar 20, 2014 by Nikita Sehgal

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes

Source : http://lanoie.net/classes/CSS/selectors_and_structure/lectures/lecture9.html
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
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...