What Is a Contextual Selector

Q

What Is a Contextual Selector? - CSS Tutorials - Introduction To CSS Basics

✍: FYIcenter.com

A

A contextual selector selects a HTML tag that is nested inside another specified tag. Contextual selectors are specified with two tags separated with a space like (outer_tag inner_tag). For example, the following CSS definition uses a contextual selector:

/* set paragraph inside a table to use arial font family */
FORM P {font-family: arial}

If you apply the above CSS definition to the following HTML document, you will get the search instruction block in "arial" font family:

<form action=search.cgi>
<p>Search instruction...</p>
<input type=submit value=Search>
</form>

<p>Other normal paragraphs...</p>

2007-05-11, 5096👍, 0💬