From 62e0170cc3baeff615de5c4958a5a65f51a4e5cf Mon Sep 17 00:00:00 2001 From: Diem-Trang Pham <6422507+pdtrang@users.noreply.github.com> Date: Thu, 23 Oct 2025 10:03:08 -0500 Subject: [PATCH] feat(curriculum): add interactive examples to pseudo classes lesson (#62958) --- .../672aa74f761c065c9828a95e.md | 62 +++++++++++++++++-- 1 file changed, 58 insertions(+), 4 deletions(-) diff --git a/curriculum/challenges/english/blocks/lecture-working-with-pseudo-classes-and-pseudo-elements-in-css/672aa74f761c065c9828a95e.md b/curriculum/challenges/english/blocks/lecture-working-with-pseudo-classes-and-pseudo-elements-in-css/672aa74f761c065c9828a95e.md index 6fe45d19f7a..8fc285b10b2 100644 --- a/curriculum/challenges/english/blocks/lecture-working-with-pseudo-classes-and-pseudo-elements-in-css/672aa74f761c065c9828a95e.md +++ b/curriculum/challenges/english/blocks/lecture-working-with-pseudo-classes-and-pseudo-elements-in-css/672aa74f761c065c9828a95e.md @@ -5,7 +5,7 @@ challengeType: 19 dashedName: what-are-pseudo-classes --- -# --description-- +# --interactive-- Pseudo-classes are special CSS keywords that allow you to select an element based on its specific state or position. The element's state or position could include: @@ -28,24 +28,46 @@ Let's see how you can use a pseudo-class to represent each of the states and pos The `:active` pseudo-class lets you select the active state of an element, like clicking on a button: +:::interactive_editor + +```html + + +``` + ```css button:active { background: greenyellow; } ``` +::: + The `:hover` pseudo-class defines the hover state of an element. An example would be hovering over a button or link: +:::interactive_editor + +```html + +Hover over me! +``` + ```css a:hover { text-decoration: none; + color: white; background: crimson; } ``` -The `:first-child` pseudo-class selects an element that is the first child of its parent element. Here's an HTML example showing a `div` element containing multiple paragraph elements: +::: + +The `:first-child` pseudo-class selects an element that is the first child of its parent element. Here's an example of targeting the first paragraph element in a `div` container: + +:::interactive_editor ```html +
first child
second child
@@ -54,8 +76,6 @@ The `:first-child` pseudo-class selects an element that is the first child of itfirst child
+second child
+third child
+last child
+