Pseudo element as background inside CSS

I try to make pseudo element as background image.
How to manage this using CSS. An example of pseudo:

.foo:before {
  content: "\e001";
  font-family: "icomoon";
}

and CSS without pseudo:

myclass {
 background: url("images/icons1.png") no-repeat scroll 26px 23px;
 padding: 11px 8px 11px 61px;
}

How to manage using pseudo element like usual pure CSS: background: url…

Need help.

From what you post, it’s not clear what you are asking.
The pseudo element you post looks like an icon.
But you want the element to have a background image?
Then simply put the background property into your pseudo element. It will still need a content property, but it may be just an empty string, if you want no actual content in the element. Then you will likely need to add positioning and sizing to give it some area. Though the exact method will depend on the context, which I am not party to.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.