Skip to content
This repository was archived by the owner on Aug 14, 2026. It is now read-only.
This repository was archived by the owner on Aug 14, 2026. It is now read-only.

Is nesting necessary in some situations?  #215

Description

@dominikgorczyca

For example, let's say we have button with an icon in it. When we hover the button I want the icon to change the color so I would need something like this:

.btn:hover .icon {
      // styles
}

If I just added the styles to the icon itself, hovering the button won't work but I guess you could add :hover to .icon and call it a day. There's a problem with it though, because I cannot focus on icon I indeed need to style the button:focus .icon to apply styles to the .icon.
Is there a way to avoid this or is this one of the exceptions where you can use nesting?
Do you use Javascript for such thing?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions