I have a related content section on my page through views in which i want one field to be a div with a background-image.
Ok, then you can use Image URL Formatter. Which will output your image as a url instead of the actual image.
Then add the image field, which contains the image you want to use as background
- Hide it from display.
- Select image url as your formatter
Add a custom field OR Rewrite the result of an existing field and use the image replacement pattern.
ex <img class="[YOUR CLASS]" src="{{ field_image }}">
OR if you create a .html.twig template file for your view, then you can use
<div class="[YOUR CLASS]" style="background-image: url('{{ field_image }}')"></div>
###Another option
Another option
In Style settings you can add a class to your fields.
[
Then with css give it a z-index: 0;
and give everything else z-index: 1;
and move img around by giving it position: absolute; top: -100px;
etc..