@mixin item {
/* Element Styling */
::before {
/* Element ::Before Styling */
}
:hover::before {
/* Hover animation to be performed by the before when the main element is in a hover state */
}
}
.item {
@include item;
}
This SCSS example produces the following in CSS
.item {
/* Element Styling */
}
item ::before {
/* Element ::Before Styling */
}
item :hover::before {
/* Hover animation to be performed by the before when the main element is in a hover state */
}
Because of the nature of how mixins work, it adds a space between item
and ::before
which causes those to not be associated with each other in the manner that is expected. When this space is removed the element behaves as expected.
How would I go about using the same or similar method to achive the following output?
.item {
/* Element Styling */
}
item::before {
/* Element ::Before Styling */
}
item:hover::before {
/* Hover animation to be performed by the before when the main element is in a hover state */
}
If you can't tell what the difference is, item ::before
is now item::before
and so on...