V
V
Vladimir2016-11-04 17:34:24
MODX
Vladimir, 2016-11-04 17:34:24

Is it possible to display an additional field in css?

Task: In each resource, change the site header through an additional field.
At first I thought to simply insert a style into each page and load the image address there through an additional field . But this is probably wrong. Or I'm wrong ? Then I thought that it would probably be better to immediately display the additional field in css. Created a style.css resource In it, where the background style is set, inserted the output of the additional field. Registered the path to the style , through the additional. field inserted the path to the picture and everything is fine. Everything is working . But I used to load all styles through MinifyX , if I just write the path to the style without it, everything is displayed well, but some styles break for some reason ... And if I write the style in MinifyX<style>.shapka[[*header]]</style>
.headerimg{background-image: [[*header]]; }
[[++site_url]][[~36]]
[[++site_url]][[~36]],then the page is displayed without styles at all ..
Maybe I don't understand MinifyX, and it doesn't work because it has something to do with caching?
In general, I probably have 2 questions, what would be the best way to do it? and why the resource cannot be displayed through MinifyX and is it possible to use css as a resource in this way?

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
A
atov, 2016-11-05
@atov

The easiest option is to use inline css. For example:

<div style="background:url([[*header]]) center;"></div>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question