Forum

Thread tagged as: Question

Perch template - embedded styles (CSS background images)

Hi,

I have the following Perch Block:

<perch:block type="slides" label="Slides">
<style>
.bss-slides div:nth-child(<perch:content id="slidechild" type="select" label="Slide Child" options="1,2,3,4,5,6,7,8" help="Select slideshow child"/>) span{background:url(<perch content id="slideimage" type="file" label="Slide Image" help="Select slideshow image"/>);}
</style>
<div class="gallery">
<div class="bss-slides">
<div class="bss-show"><span></span></div>
<div><span></span></div>
<div><span></span></div>
<div><span></span></div>
<div><span></span></div>
<div><span></span></div>
<div><span></span></div>
<div><span></span></div>
<div><span></span></div>
<div><span></span></div>
<div><span></span></div>
<div><span></span></div>
<span class="bss-prev"></span>
<span class="bss-next"></span>
</div>
</div>
</perch:block>

but all that appears is the nth-child() select so I was wondering if anyone would be able to point to any limitations in Perch or otherwise mistakes in my code please.

I tried what was in the following post:

https://forum.grabaperch.com/forum/12-22-2016-create-fields-for-css-background-images-as-perch-fields

and replaced file="" with image="" but no luck.

Thanks for any help offered.

P.S. I can supply the complete template if that is of any assistance

Garth Holmes

Garth Holmes 0 points

  • 4 years ago

Hi,

The syntax of <perch content id="slideimage" type="file" label="Slide Image" help="Select slideshow image"/> is wrong, it should be <perch:content id="slideimage" type="file" label="Slide Image" help="Select slideshow image"/>. You miss the colon in between perch and content.

Also, you should use type="image".

Thank you :)