Irving Armenta Irving Armenta - 2 months ago 12
CSS Question

Using content: " "; in SASS (not scss)

This must be a very simple question for experienced SASS coders, I'm starting to work with it instead of using SCSS,
All i want to know is how to make pseudo-elements with a "blank" content element, in order to make them work (appear on DOM)
I'll write it in scss:

#element {
&:before {
content:'';
}
}


This is what i want to accomplish in SASS, it won't compile if i write it like this:

#element
&:before
content:''


it seems to be expecting a value of content, i use this in order to make decorative pseudo-elements, like borders,lines, or elements with another bg, a lot of stuff like:

#element {
&:before {
content:'';
top: 0;
left: 0;
width: 100px;
height: 100px;
background-color: black;
}
}


This is just an example, i know the syntax for css and scss, but for sass it just won't compile.

Answer

In your example you haven't space between content: and quotes. I get an error without space (SASS expect a pseudo-class or pseudo-element) but works fine with space:

#element
  &:before 
    content: ''
Comments