Ampersand - Chapter 4

  • 0
We can reference the parent selector using ampersand.
Hover the link and see that it gets a red background with white foreground color.

Here, check on the sass section, Line 27, how we have used the &:hover inside the 'a' tag. This is same as saying a:hover in our normal css. This is an easy way of attaching pseudo classes.

We will see some of the benefits of the ampersand in the next chapter when we discuss the responsive web based style changes when there will be requirements like, if the body contains an ID called this, then certain elements should have certain styles. Else not.


No comments:

Post a Comment