Professional Documents
Culture Documents
G8 Q4 Webpage Design
G8 Q4 Webpage Design
CSS SELECTORS
CSS Selectors are used to find HTML elements based on their element name, id, class, and
attribute.
ELEMENT SELECTOR
The element selector selects elements based on the element name.
ID SELECTOR
The id selector uses the id attribute of an HTML element to select a specific element. The id of an
element should be unique within a page, so the id selector is used to select one unique element. To select
an element with specific id, write a hash character (#), followed by the id of the element. An id name
cannot start with a number.
CLASS SELECTOR
The class selector selects elements with a specific class attribute. To select elements with a
specific class, write a period (.) character, followed by the name of the class. A class name cannot start
with a number. HTML elements can also refer to more than one class.
GROUPING SELECTOR
Grouping selectors will be ideal if you have elements with the same style definitions. Grouping
selectors will help minimize the length of the code. To group selectors, separate each selector with a
comma.
Match the words in Column A with its definition in Column B. Write the letter of your answer on the
space provided before each number.
______1. This selector helps you minimize the length of the code. A. ID selector
______2. Location of internal CSS style tags B. Grouping selector
______3. Selects elements based on element name C. Class selector
______4. Hash (#) character D. Element selector
______5. Period (.) character E. Body
F. Head