What are Context Dependents?
By using Group Selectors we can assign styling to make selectors that will only work incertain contexts.
We can use context dependent and grouped selectors simultaneously.
How Context Dependents are used?
i b { color:red;}
This means the font color of those texts will be red which are bold and written in italics.
You may require to change a property of text depending on its other property. Let us suppose
we have two sentences, one written in bold and the other written in both italics and bold. You
want to change the color of the sentence written in both bold and italics and not for the
sentence written in bold. You can make this happen by context dependents.
Let us consider the example
i b { color:red;}
This means only the texts which are both bold and written in italics will appear in red.
It is possible to make selectors that will only work in certain contexts.
For example, you can define a style for the <b> tag that is only triggered if the text is not only
bold but also written in italics.
For example, the style should be in effect here:
<i><b>example</b></i>
but not here :
<b>example</b>.
0 comments:
Post a Comment