What Is a Class Selector in CSS?
Submitted by: AdministratorA class selector selects all HTML tags that matches the class name defined in the tag attribute of class="class_name". Class selectors are specified with a leading dot like (.class_name). For example, the following CSS definition uses a class selector:
/* set text to italic to all tags with class="quote" */
.quote {font-style: italic}
If you apply the above CSS definition to the following HTML document, you will get two blocks in italic, one from the <p> tag and one from the <pre> tag:
<p>Normal paragraph...</p>
<p class="quote">Special paragraph...</p>
<pre>Normal pre-formatted text...</pre>
<pre class="quote">Special pre-formatted text...</pre>
Submitted by: Administrator
/* set text to italic to all tags with class="quote" */
.quote {font-style: italic}
If you apply the above CSS definition to the following HTML document, you will get two blocks in italic, one from the <p> tag and one from the <pre> tag:
<p>Normal paragraph...</p>
<p class="quote">Special paragraph...</p>
<pre>Normal pre-formatted text...</pre>
<pre class="quote">Special pre-formatted text...</pre>
Submitted by: Administrator
Read Online Cascading Style Sheet CSS Job Interview Questions And Answers
Top Cascading Style Sheet CSS Questions
☺ | What Are the Formatting Behaviors of HTML Elements? |
☺ | How To Use IDs to Override Classes in CSS? |
☺ | What Is a ID Selector in CSS? |
☺ | What Is a Class Selector in CSS? |
☺ | What Is a Contextual Selector in CSS? |
Top Top World Wide Web Categories
☺ | Cascading Style Sheet CSS Interview Questions. |
☺ | HTML5 Interview Questions. |
☺ | Basic Internet Interview Questions. |
☺ | Domain Name System (DNS) Interview Questions. |
☺ | JavaScript Interview Questions. |