Sass Nesting for :hover does not work

Beach Boys picture Beach Boys · Apr 13, 2013 · Viewed 297.3k times · Source

I've written this code, but it does not work. What is my problem?

.class {
    margin:20px;
    :hover {
        color:yellow;
    }
 }

Answer

Sinac picture Sinac · Apr 13, 2013

For concatenating selectors together when nesting, you need to use the parent selector (&):

.class {
    margin:20px;
    &:hover {
        color:yellow;
    }
}