Elements that are not a direct child of the specified parent are not selected. For example,
ul > li selects the li element that is placed just after the ul in the code.
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 can be used to select one unique element.
To select an element with a specific ID, write a hash # character, followed by the ID of the element.
The style rule below is applied to the HTML element with id="para1"
#para1The 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.
In the example below, all HTML elements with class="center" are selected using this selector:
.centerIt is also possible to indicate that only specific HTML elements should be affected by a class.
The example below indicates only <p> elements with class="center" use the selector:
p.centerHTML elements can also refer to more than one class.
In the example below, the <p> element is selected with both center and large as classes class="center large" . Use this selector:
p.center.largeThe :nth-child(n) selector matches every element that is the nth child, regardless of its parent type. n can be a number, a keyword, or a formula. In this example, is will typically be set to match by number.
The selector below will select the 2nd p element in this example:
<p>Paragraph 1</p>
<p>Paragraph 2</p>
<p>Paragraph 3</p> Selector:
p:nth-child(2)Takes the parent element of the selected element.
We have created a series of custom CSS selectors that do NOT exist in normal CSS and only in the PageAssist system.
Allows you to select the next element on the same level.
External resources:
For more information about CSS selectors with examples, see:
For instructions, visit PageAssist setup.
If this content did not answer your questions, try searching or contacting our support team for further assistance.
If this content did not answer your questions, try searching or contacting our support team for further assistance.