Which of the following CSS selectors is used to specify a style for a single, unique element and is
defined with a “#”?
A.
Class
B.
Id
C.
Type
D.
Universal
Explanation:
The id selector is used to specify a style for a single, unique element. It uses the id attribute of the
HTML element, and is defined with a “#”. For example, id=”id1″:
#id1
{
text-align:center;
color:green;
}Answer C is incorrect. A type selector matches every instance of the element type in the document
tree.Answer A is incorrect. The class selector is used to specify a style for a group of elements. It can be
used on several elements. It allows a user to set a particular style for many HTML elements with the
same class. It uses the HTML class attribute and is defined with a “.” For example, all t elements with
class=”center” will be center-aligned:
t.center {text-align:center;}Answer D is incorrect. The universal selector matches the name of any element type. It matches any
single element in the document tree.