This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

KushMedia
KushMedia

How would I go about referencing the post featured image using inline css background?

Instead of having it as an image source like so...

<img src="{{ post.featured_images.first.getThumb(100, 'auto') }}" />

Have it as an inline style, which is what my theme calls for also not forcing it to be a thumbnail image.

<div class="post feature-post" style="background-image:url(../images/post/w1.jpg); background-size:cover;">

Thank you!

Last updated

hamza.berjamy22350
hamza.berjamy22350

You can do this : <img style="background:url(../images/post/w1.jpg) no-repeat center center;background-size:cover;/>

KushMedia
KushMedia

I got this to work like so...

<div class="post feature-post" style="background-image:url({{ post.featured_images.first.getThumb('auto', 'auto') }}); background-size:cover;">

Last updated

hamza.berjamy22350
hamza.berjamy22350

Put backgroud:url not background-image:url

jjkjunk26057
jjkjunk26057

KushMedia thank you!!!!!

1-5 of 5

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.