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 an element with id "demo"?

2

How do you make a list that lists its items with squares?

3

When using the padding property; are you allowed to use negative values?

4

Which property is used to change the left margin of an element?

5

How do you display a border like this:
The top border = 10 pixels
The bottom border = 5 pixels
The left border = 20 pixels
The right border = 1pixel?

Comments