We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46971
    • 33 Posts
    I want any user being able to change / choose a hero image for a website. Usually I set up these images in the less file. But I don't want to give access to these less / css files in modx. The less / css workflow should be beside modx on the ftp-server.

    So how can I change any background image in modx without access to less / css?
    I have one example with an additional div-tag and inline-styling:

    <div class="hero-image" style="background-image:url('[[*hero-image]]'); background-repeat:no-repeat; background-size:cover; background-position:center 0%; position: absolute; width: 100%; left: 0; top: 0; bottom: 0;"> </div>


    Maybe there are better solutions?

    (yes, I can clean up the inline-styling a bit with the css-class "hero-image". I only want you to see the styling of this example. Though in this solution some inline-styling is needed to use the teplate variables of modx?!)
      • 17301
      • 932 Posts
      How you've done it is how I would do it personally.
        ■ email: [email protected] | ■ website: https://alienbuild.uk

        The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.