CSS Multiple choices


Total available count: 25
Subject - Web Development
Subsubject - CSS

How do you select elements with the class name "test"?


 

 

 

 



A


Solution:-
  1. Definition and Usage of the .class selector select elements with a specific class attribute
  2. To select elements with a specific class, start with a period (.) character, followed by the class name
  3. You can also specify that only specific HTML elements should be affected by a given class. To implement this, start with the element name for example p, then write the period (.) character, followed by the class name (look at Example 1 below)
  4. HTML elements can also refer to more than one class (look at Example 2 below)
CSS Syntax
.class {
 css declarations;
}

More Examples
Example 1
Style all <p> elements with class="slightbook":

p.slightbook {
 background-color: yellow;
}

Example 2
This <p> element will be styled according to class="slight" AND to class="book":

<p class="slight book">This paragraph refers to two classes.</p>

Example
Select and style all elements with class="slightbook":

.slightbook {
 background-color: red;
}

 




Next 5 multiple choice(s)

1

How do you select all p elements inside a div element?

2

How do you, group selectors?

3

What is the default value of the position property?

4

What happens if you open the external CSS file in a browser?

5

What does CSS stand for?

Comments