Proper way to link to images from css? - General Discussions - General Discussions - Progress Community
 General Discussions

Proper way to link to images from css?

  • Proper way to link to images from css?
  • I'm attempting to create a custom theme in sitefinity 4. Right now I'm working with the layout.css file in my new theme but I need to add references to images stored in the images folder. Right now I have to use a very long url to get to the images, while I've seen in other theme's css files some type of folder referencing that uses . (period) instead of / .

    I have to use : /sitefinity4/Sitefinity/WebsiteTemplates/MaxQ/App_Themes/DefaultTheme/images/bg.jpg

    while I see this used elsewhere :
    url(<% = WebResource("Telerik.Sitefinity.Resources.Themes.Basic.Images.sfPublicContent.gif") %>)

    What's going on there? Can I use that type of referencing? I've read through the designers guide and it tells me everything except how to actually design and implement a theme... although it was helpful when I was setting up the new theme.

    What is the preferred way for defaultheme/global/layout.css or reference images stored in defaulttheme/images ?
  • Hello Chris,

    The stylesheet is located in the theme folder where is Images folder, so you can reference an image as shown below

    background:url(../Images/bg.gif);


    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • Ivan,

     How I can refer to image in theme from template?

     For example, I've added Content Block and need to add <img> tag.

     

    Thanks!

     

    P.S.: Seems, I found answer here: www.sitefinity.com/.../images