Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • geinian 6 posts 76 karma points
    Nov 13, 2019 @ 20:25
    geinian
    0

    Umbraco background image

    Hello, guys.

    How do I insert a background image on my site? I want it to appear on every page.

    Thanks

  • Amir Khan 1282 posts 2739 karma points
    Nov 13, 2019 @ 20:51
    Amir Khan
    0

    You can add a media picker datatype (make sure its set to single) to your document type then you can render it like so and add your appropriate styles. In this case the "true" will make the property recursive so it will look up the tree for one being set. Its a little different depending on version, but you can find the docs here: https://our.umbraco.com/Documentation/Getting-Started/Backoffice/Property-Editors/Built-in-Property-Editors/Media-Picker/index-v7

    @{
        var typedMediaPickerSingle = Model.Value<IPublishedContent>("backgroundImageAlias", true);
        if (typedMediaPickerSingle != null)
        {
            <div style="background-image: url(@typedMediaPickerSingle.Url)"></div>
        }
    }
    
  • geinian 6 posts 76 karma points
    Nov 14, 2019 @ 11:53
    geinian
    0

    Good morning, Amir Khan.

    you could demonstrate an example of this configuration.

    Thank you for your support.

Please Sign in or register to post replies

Write your reply to:

Draft