Variable background in wordpress

I have profiles in my WordPress website, every profile has its own image
I want to use that image as background of that current page too, Is it possible to use a Class in CSS which contains the image link as a Value of a new line of CSS?

.panel {
   background: "class(col-sm-4)";
}

There is certainly no way to accomplish this by default in WordPress using only CSS. The background property only accepts specific arguments, and implementing variables as values is not possible without more advanced techniques than you get with out-of-the-box CSS.

Check this link for a full explanation of the background property and its accepted arguments.

However, since you are using WordPress, you probably have the ability to insert Javascript/jQuery code into your site or page that would easily achieve the same effect.

If you update your question to give an example of your page content, we can make recommendations about how to accomplish the look you’re targeting.