Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions js/levels.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,12 +393,23 @@ var levels = [
selectorName: "Nth Last Child Selector",
helpTitle: "Select an element by its order in another element, counting from the back",
doThis : "Select the 1st bento",
selector : "bento:nth-last-child(3)",
selector : ["bento:nth-last-child(3)", "bento:nth-of-type(1)"], // Array for multiple selectors
syntax: ":nth-last-child(A)",
help : "Selects the children from the bottom of the parent. This is like nth-child, but counting from the back!",
examples : [
'<strong>:nth-last-child(2)</strong> selects all second-to-last child elements.'
'<strong>:nth-last-child(2)</strong> selects all second-to-last child elements.',
'<strong>p:nth-last-child(3)</strong> selects the third-to-last `<p>` element within its parent.', // added new example for better understanding
],
// also another apporch: Adding Nth-of-Type information
additionalInfo: {
selectorName: "Nth-of-Type Selector",
helpTitle: "Select an element based on its occurrence among siblings of the same type.",
syntax: ":nth-of-type(A)",
help: "Targets elements of the same type by their position within a parent, counting from the start. Similar to :nth-child, but it only considers siblings of the same type, not all child elements.",
examples: [
'<strong>p:nth-of-type(3)</strong> selects the third `<p>` element within its parent.'
]
},
boardMarkup: `
<plate/>
<bento/>
Expand Down